transcodeninja / livepeer-exporter

A Prometheus exporter for Livepeer orchestrator metrics. Fetches and exposes orchestrator metrics from various Livepeer endpoints for Prometheus to scrape.
https://hub.docker.com/r/rickstaa/livepeer-exporter
MIT License
0 stars 0 forks source link
exporter livepeer orchestrator prometheus prometheus-exporter transcoding
Docker Build Publish Docker image Docker Image Version (latest semver) Latest Release

Livepeer Exporter

image

Livepeer Exporter is a lightweight tool designed to enhance the monitoring capabilities of Livepeer. As a Prometheus exporter, it fetches various metrics from different Livepeer endpoints and exposes them via an HTTP server, ready for Prometheus to scrape. It streamlines the Prometheus scraping process by eliminating the sluggish data extraction through Grafana plugins like marcusolsson-json-datasource and yesoreyeram-infinity-datasource. This makes it the perfect companion to the Livepeer monitoring service, extending the range of Livepeer metrics that can be monitored. By providing deeper insights into Livepeer's performance, Livepeer Exporter helps users optimize their streaming workflows and ensure reliable service delivery. Witness it in action by exploring the Grafana dashboards of the transcode.eth orchestrator.

Configuration

Before using the Livepeer Exporter, you must configure it using environment variables. These variables allow you to customize the behaviour of the exporter to suit your specific needs. Below, you'll find a list of all the environment variables you can set, a description of what they do, and their default values if they are not specified.

Required environment variables

Optional environment variables

All intervals are specified as a string representation of a duration, e.g., 5m for 5 minutes, 2h for 2 hours, etc. See time#ParseDuration for format details.

[!IMPORTANT]\ Please be respectful when setting the fetch intervals. Setting these values to low will cause unnecessary load on the Livepeer infrastructure. If you are unsure what values to use, please use the defaults. Thanks for your understanding ❤️!

Usage

This section explains how to run the Livepeer Exporter. You can run it locally on your machine or use Docker for easy setup and teardown.

Run exporter locally

Running the exporter on your main OS allows you to test out the livepeer-exporter quickly. You must set the necessary environment variables and start the exporter to do this. Replace your-orchestrator-address with your values:

export LIVEPEER_EXPORTER_ORCHESTRATOR_ADDRESS=your-orchestrator-address
go run main.go

The exporter will be available on port 9153. Additional configuration environment variables can be passed to the exporter by adding them to the command above.

Running the Exporter with Docker

You can run the exporter using the Docker image available on Docker Hub. To pull and run the exporter from Docker Hub, use the following command:

docker run --name livepeer-exporter \
    -e "LIVEPEER_EXPORTER_ORCHESTRATOR_ADDRESS=<your-orchestrator-address>" \
    -p 9153:9153 \
    transcodeninja/livepeer-exporter:latest

Replace <your-orchestrator-address> with the address of your orchestrator. This command will start the exporter and expose the metrics on port 9153 for Prometheus to scrape. This command will start the exporter and expose the metrics on port 9153 for Prometheus to scrape. Additional environment variables can be passed to the exporter by adding them to the command above.

[!NOTE]\ This repository also contains a DockerFile and docker-compose.yml file. These files can be used to build and run the exporter locally. To do this, clone this repository and run docker compose up in the repository's root directory.

Configure Prometheus

For Prometheus to scrape the exporter, add the following to your prometheus.yml:

scrape_configs:
  - job_name: livepeer-exporter
    static_configs:
      - targets: ["localhost:9153"]

This configuration tells Prometheus to scrape metrics from the Livepeer Exporter running on localhost port 9153.

Metrics

This exporter comprises the following sub-exporters, each responsible for fetching specific metrics:

Sub-Exporter Description
orch_info_exporter Collects metrics pertaining to the Livepeer orchestrator.
orch_score_exporter Retrieves metrics concerning the Livepeer orchestrator's score.
orch_delegators_exporter Gathers metrics related to the delegators of the designated Livepeer orchestrator.
orch_test_streams_exporter Procures metrics about the Livepeer orchestrator's test streams.
orch_tickets_exporter Fetches metrics about the Livepeer orchestrator's tickets.
orch_reward_exporter Retrieves metrics about the Livepeer orchestrator's rewards.
crypto_prices_exporter Fetches and exposes the prices of different cryptocurrencies used in the Livepeer ecosystem.

For enhanced performance, these sub-exporters operate concurrently in separate goroutines. They fetch metrics from various Livepeer endpoints and expose them via the 9153/metrics endpoint. For detailed information about these sub-exporters and the metrics they provide, refer to the sections below.

Crypto Prices Exporter

The crypto_prices_exporter fetches and exposes the prices of different cryptocurrencies used in the Livepeer ecosystem. They include:

GaugeVec metrics:

orch_delegators_exporter

The orch_delegators_exporter fetches metrics about the delegators of the set Livepeer orchestrator from the Livepeer subgraph endpoint. These metrics provide insights into the number and behaviour of the delegators that stake with the orchestrator. They include:

Gauge metrics:

GaugeVec metrics:

orch_info_exporter

The orch_info_exporter fetches metrics about the Livepeer orchestrator from the Livepeer Orchestrator API and Livepeer Delegating API endpoints. These metrics provide insights into the orchestrator's performance and behaviour. They include:

Gauge metrics:

orch_rewards_exporter

The orch_rewards_exporter fetches reward data for the Livepeer orchestrator from the Livepeer subgraph endpoint. These metrics provide insights into the rewards the orchestrator claims. They include:

Gauge metrics:

GaugeVec metrics:

[!NOTE]\ Due to an upstream bug, the livepeer_orch_reward_gas_used metric currently shows the gas limit instead (see this upstream issue). This will be fixed once the upstream issue is resolved.

orch_score_exporter

The orch_score_exporter fetches metrics about the Livepeer orchestrator's score from the Livepeer Score API endpoint. These metrics provide insights into the performance of the orchestrator. They include:

Gauge metrics:

GaugeVec metrics:

orch_test_streams_exporter

The orch_test_streams_exporter fetches metrics about the Livepeer orchestrator's test streams from the https://leaderboard-serverless.vercel.app/api/raw_stats API endpoint. These metrics provide insights into the performance of the orchestrator's test streams in different regions. They include:

GaugeVec metrics:

orch_tickets_exporter

The orch_tickets_exporter fetches and exposes winning ticket transaction information from the Livepeer subgraph endpoint. These metrics provide insights into the orchestrator's winning tickets. They include:

Gauge metrics:

GaugeVec metrics:

[!NOTE]\ Due to an upstream bug the livepeer_orch_winning_ticket_gas_used metric currently shows the gas limit instead (see this upstream issue). This will be fixed once the upstream issue is resolved.

Contributing

Feel free to open an issue if you have ideas on how to make this repository better or if you want to report a bug! All contributions are welcome. :rocket: Please consult the contribution guidelines for more information.

Shout-out

🚀 Stronk.rocks: Special thanks to @stonk-dev for pointing me to the needed API endpoints needed to implement this exporter.