Self-Hosted Metrics
If you want complete control over your metrics data, you can run your own metrics server. Our metrics system is open source and available on GitHub.
Overview
The repository is a monorepo containing both the server (written in Elixir) and the client library (written in TypeScript). The server runs on Elixir with Postgres and utilizes TimescaleDB for efficient time-series data storage.
Getting Started
To get started with your own metrics server:
Clone the repository:
git clone https://github.com/maveio/metrics.git
cd metrics
Start the server using Docker Compose:
docker compose up metrics
Access the server at http://localhost:3000/
The server will run with example videos and an example API key to get you started.
Configuration
You can start the server without setting any environment variables. However, for production use, we recommend configuring authentication:
METRICS_AUTH_ENABLED=true
METRICS_USER=your_username
METRICS_PASSWORD=your_password
⚠️ Use the API to generate a new API key before going to production.
Connecting Your Videos
To connect your videos to your self-hosted metrics server, configure the metrics settings in your components library:
<script crossorigin type="module">
import {
Player,
setConfig,
} from "//cdn.video-dns.com/npm/@maveio/components/+esm";
setConfig({
metrics: {
enabled: true,
socket: "wss://your_metrics_server_domain/socket",
},
});
</script>
Support
If you have questions or need assistance with setting up your self-hosted metrics server, reach out to our support team or join our Discord community.