> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring Setup

> Configure Prometheus and Grafana for a Livepeer gateway - enable metrics, set up scraping, key metrics by workload type, Docker monitoring stack, Grafana dashboards, and alert recommendations.

This guide sets up production observability for a Livepeer Gateway using Prometheus and Grafana. The Gateway must already be running

* for quick verification, see [Health Checks](/v2/gateways/guides/monitoring-and-tooling/health-checks.md).

For on-chain Gateways, Prometheus metrics complement but do not replace [On-Chain Metrics](/v2/gateways/guides/monitoring-and-tooling/on-chain-metrics.md)

* contract events and deposit state require separate monitoring.

## Enable Metrics

Add the `-monitor` flag when starting the Gateway. Without it, the `/metrics` endpoint is not exposed.

```bash icon="terminal" Enable Metrics theme={null}
livepeer \
  -gateway \
  -monitor \
  -metricsPerStream \
  -httpAddr 0.0.0.0:8935 \
  [other flags...]
```

**Monitoring flags:**

<table>
  <tr>
    Flag

    Purpose

    Recommendation
  </tr>

  <tr>
    `-monitor`

    Enables the `/metrics` Prometheus endpoint

    Always enable in production
  </tr>

  <tr>
    `-metricsPerStream`

    Groups performance metrics by individual stream

    Enable for per-stream debugging; note higher metric cardinality
  </tr>

  <tr>
    `-metricsClientIP`

    Includes client IP as a metric label

    Enable only for per-client breakdown
  </tr>
</table>

**Verify metrics are exposed:**

```bash icon="terminal" Verify Metrics theme={null}
curl http://localhost:8935/metrics | head -30
```

Prometheus-format output with `livepeer_` prefixed metric names confirms the endpoint is active.

## Setup

> [tab] Prometheus
>
> ### Configuration
>
> [Prometheus Metrics Reference](/v2/gateways/resources/reference/go-livepeer/prometheus-metrics.md)
>
> Create or update `prometheus.yml` to scrape the Gateway:
>
> ```yaml icon="terminal" theme={null}
> global:
> scrape_interval: 15s
> evaluation_interval: 15s
>
> scrape_configs:
> - job_name: 'livepeer-gateway'
>     static_configs:
>     - targets: ['localhost:8935']
>     metrics_path: '/metrics'
>     scrape_interval: 15s
>     scrape_timeout: 10s
>     labels:
>     node_type: 'dual'
>     environment: 'production'
> ```
>
> All Gateway types (Video, AI, Dual) expose metrics on the same `-httpAddr` port (default 8935). A single scrape job covers both video and AI metrics.
>
> Adjust the `node_type` label to match the deployment: `video`, `ai`, or `dual`.

> [tab] Docker Stack
>
> ### Monitoring Container
>
> The `livepeer/livepeer-monitoring` repository bundles Prometheus, Grafana, and starter dashboard templates in a single Docker deployment.
>
> [//]: # "REVIEW: Confirm that the livepeer-monitoring repository is current and maintained."
>
> ```bash icon="terminal" theme={null}
> # Clone the monitoring repository
> git clone https://github.com/livepeer/livepeer-monitoring
> cd livepeer-monitoring
>
> # Start the stack
> docker compose up -d
> ```
>
> The stack starts:
>
> * **Prometheus** on port `9090` - scraping the Gateway at `localhost:8935`
> * **Grafana** on port `3000` - default credentials `admin / admin`
>
> Update `prometheus.yml` in the repo to point to the Gateway host if it is not on `localhost`.

## Key Metrics

> [tab] Video
>
> Video - on-chain Gateways.
> \
> &#x20;Full reference: [Prometheus Metrics](/v2/gateways/resources/reference/go-livepeer/prometheus-metrics.md).
>
> ### Performance
>
> <table>
>   <tr>
>     Metric
>
>     What it shows
>
>     Alert threshold
>   </tr>
>
>   <tr>
>     `livepeer_segment_transcoded_total`
>
>     Successfully transcoded segments (counter)
>
>     Calculate success rate (see queries below)
>   </tr>
>
>   <tr>
>     `livepeer_transcode_overall_latency_seconds`
>
>     End-to-end transcoding latency
>
>     Alert when avg `> 5s`
>   </tr>
>
>   <tr>
>     `livepeer_segment_transcode_failed_total`
>
>     Cumulative failed transcode count
>
>     Alert on rate increase
>   </tr>
>
>   <tr>
>     `livepeer_orchestrator_swaps`
>
>     Mid-stream Orchestrator changes
>
>     Alert on high rate
>   </tr>
>
>   <tr>
>     `livepeer_current_sessions_total`
>
>     Active transcoding sessions
>
>     Capacity planning
>   </tr>
> </table>
>
> [//]: # "REVIEW: Confirm whether livepeer_success_rate exists directly or must be derived from segment counters."
>
> ### Payments
>
> <table>
>   <tr>
>     Metric
>
>     What it shows
>
>     Alert threshold
>   </tr>
>
>   <tr>
>     `livepeer_gateway_deposit`
>
>     Remaining ETH deposit (wei)
>
>     Alert when `< 10000000000000000` (0.01 ETH)
>   </tr>
>
>   <tr>
>     `livepeer_gateway_reserve`
>
>     Remaining ETH reserve (wei)
>
>     Alert when `< 5000000000000000` (0.005 ETH)
>   </tr>
>
>   <tr>
>     `livepeer_ticket_value_sent`
>
>     ETH value of tickets issued
>
>     Budget tracking
>   </tr>
>
>   <tr>
>     `livepeer_payment_create_errors`
>
>     Failed ticket creation
>
>     Alert on any increase
>   </tr>
>
>   <tr>
>     `livepeer_suggested_gas_price`
>
>     Arbitrum gas price oracle
>
>     Alert on spike
>   </tr>
> </table>
>
> > [!WARNING]
> >
> > `livepeer_gateway_deposit` and `livepeer_gateway_reserve` are the most critical alerts. When the deposit hits zero, job routing stops immediately with no warning to clients.
>
> ### Useful Queries
>
> ```promql icon="terminal" theme={null}
> # Success rate over last 5 minutes
> rate(livepeer_segment_transcoded_total[5m]) /
> rate(livepeer_segment_source_appeared_total[5m])
>
> # ETH deposit remaining in ETH (not wei)
> livepeer_gateway_deposit / 1e18
>
> # Failed transcode rate per minute
> rate(livepeer_segment_transcode_failed_total[1m])
>
> # Average transcoding latency
> rate(livepeer_transcode_overall_latency_seconds_sum[5m]) /
> rate(livepeer_transcode_overall_latency_seconds_count[5m])
> ```

> [tab] AI
>
> AI Both on-chain and off-chain Gateways.
>
> <table>
>   <tr>
>     Metric
>
>     What it shows
>
>     Alert threshold
>   </tr>
>
>   <tr>
>     `livepeer_current_sessions_total`
>
>     Active AI sessions
>
>     Capacity planning
>   </tr>
>
>   <tr>
>     `livepeer_max_sessions_total`
>
>     Configured session limit
>
>     Alert when `current > 0.8 x max`
>   </tr>
>
>   <tr>
>     `livepeer_discovery_errors_total`
>
>     Orchestrator discovery failures
>
>     Alert on any increase
>   </tr>
>
>   <tr>
>     `livepeer_segment_source_upload_failed_total`
>
>     Failed job submissions
>
>     Alert on rate increase
>   </tr>
> </table>
>
> > [!NOTE]
> >
> > AI-specific inference latency (per-pipeline, per-model) is not currently exposed via `/metrics`. For AI inference latency monitoring, use [Livepeer Tools](/v2/gateways/guides/monitoring-and-tooling/tools-and-dashboards.md) or instrument the application layer.
> >
> > [//]: # "REVIEW: Confirm whether Prometheus will expose inference latency in an upcoming release."
>
> ### Useful Queries
>
> ```promql icon="terminal" theme={null}
> # Sessions approaching capacity
> livepeer_current_sessions_total / livepeer_max_sessions_total
>
> # Discovery error rate
> rate(livepeer_discovery_errors_total[5m])
> ```

> [tab] Dual
>
> Dual - on-chain Gateways running both video and AI.
> \
> &#x20;Run all video metrics AND all AI metrics.
> \
> &#x20;The additional concern is GPU resource contention.
>
> **GPU monitoring via HTTP API:**
>
> ```bash icon="terminal" theme={null}
> # Poll hardware stats every 30 seconds
> watch -n 30 'curl -s http://localhost:8935/hardware/stats | python3 -m json.tool'
> ```
>
> Key fields to watch:
>
> * `gpu_memory_used` / `gpu_memory_total` - approach to 100% precedes model load failures
> * `gpu_utilization` - sustained 100% during low-volume periods indicates a bottleneck
>
> **When to separate workloads:**
>
> Consider splitting video and AI onto separate nodes when:
>
> * GPU memory is consistently above 85%
> * AI model loading causes video transcoding latency spikes
> * `livepeer_orchestrator_swaps` rate increases during AI inference peaks
>
> See [Scaling](/v2/gateways/guides/advanced-operations/scaling.md) for architecture patterns.

## Grafana Dashboards

The `livepeer/livepeer-monitoring` Docker stack includes three starter Grafana dashboards:

> [accordion] Node overview
>
> Active sessions, success rate, transcoding latency, and Orchestrator connectivity. The primary operational dashboard for day-to-day monitoring.

> [accordion] Payment overview
>
> ETH deposit and reserve over time, ticket value sent, and payment creation errors. Critical for on-chain Gateways to track deposit depletion rate.

> [accordion] Transcoding performance
>
> Realtime ratios, latency distribution (p50, p95, p99), and segment success/failure breakdown. Useful for identifying quality degradation patterns.

Access Grafana at `http://localhost:3000` (default credentials `admin / admin`). The starter dashboards are pre-configured to query the bundled Prometheus instance.

**Custom panels to consider adding:**

* Deposit depletion forecast (linear regression on `livepeer_gateway_deposit` over 24h)
* Session count vs `-maxSessions` limit as a percentage gauge
* AI discovery error rate overlaid with session count (correlation check)

[//]: # "REVIEW: Confirm whether the livepeer-monitoring dashboards cover AI metrics or remain video-only."

## Alert Rules

### &#x20;Critical

```yaml icon="circle-exclamation" Critical Errors theme={null}
groups:
  - name: livepeer-gateway-critical
    rules:
      - alert: GatewayDown
        expr: up{job=~"livepeer.*"} == 0
        for: 1m
        labels:
          severity: critical
        annotations:
          summary: "Livepeer Gateway is unreachable"

      - alert: DepositExhausted
        expr: livepeer_gateway_deposit < 10000000000000000
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Gateway ETH deposit critically low ({{ $value | humanize }} wei)"

      - alert: SuccessRateCritical
        expr: |
          rate(livepeer_segment_transcoded_total[5m]) /
          rate(livepeer_segment_source_appeared_total[5m]) < 0.90
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Transcoding success rate below 90%"
```

### &#x20;Warning

```yaml icon="warning" Warning Errors theme={null}
      - alert: DepositLow
        expr: livepeer_gateway_deposit < 50000000000000000
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Gateway ETH deposit below 0.05 ETH - top up soon"

      - alert: HighTranscodeLatency
        expr: |
          rate(livepeer_transcode_overall_latency_seconds_sum[5m]) /
          rate(livepeer_transcode_overall_latency_seconds_count[5m]) > 5
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "Average transcoding latency exceeds 5 seconds"

      - alert: PaymentCreateErrors
        expr: rate(livepeer_payment_create_errors[5m]) > 0
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: "Ticket creation errors - check Arbitrum RPC health"

      - alert: AIDiscoveryErrors
        expr: rate(livepeer_discovery_errors_total[5m]) > 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "Orchestrator discovery failing - check -orchAddr list"
```

## Related Pages

> [card] [Prometheus Metrics](/v2/gateways/resources/reference/go-livepeer/prometheus-metrics.md)
>
> Full table of all livepeer\_\* metrics.

> [card] [On-Chain Metrics](/v2/gateways/guides/monitoring-and-tooling/on-chain-metrics.md)
>
> TicketBroker events and Arbitrum contract monitoring.

> [card] [Tools & Dashboards](/v2/gateways/guides/monitoring-and-tooling/tools-and-dashboards.md)
>
> Explorer, Livepeer Tools, livepeer\_cli.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.