---
title: "Metrics, traces and logs"
description: "The Prometheus series a leader exposes on /metrics, the OpenTelemetry spans it emits, and how its logs are written and exported."
url: "https://opod.io/docs/core-reference/metrics/"
markdown_url: "https://opod.io/docs/core-reference/metrics.md"
section: "Core reference"
last_updated: "2026-11-08"
---

# Metrics, traces and logs

> The Prometheus series a leader exposes on /metrics, the OpenTelemetry spans it emits, and how its logs are written and exported.

## In short

A leader serves Prometheus metrics at `GET /metrics` with no key; every series starts with `opod_`. With `OPOD_OTLP_ENDPOINT` set it also exports OTLP traces. Point your scraper at the leader, or at `probe_listen` when the main port speaks TLS.

```bash
curl -s http://localhost:8080/metrics | grep '^opod_requests_total'
```

## Prometheus metrics

`GET /metrics` on the main listener (and on `probe_listen` when set). No key. All opod series start with `opod_`.

### Requests

| Series                             | Type      | Labels                         | Meaning                                                                        |
| ---------------------------------- | --------- | ------------------------------ | ------------------------------------------------------------------------------ |
| `opod_requests_total`              | counter   | `model`, `protocol`, `outcome` | Inference requests.                                                            |
| `opod_request_duration_seconds`    | histogram | `model`, `protocol`, `outcome` | End-to-end duration. Buckets 0.1 s to 300 s.                                   |
| `opod_time_to_first_token_seconds` | histogram | `model`                        | Time to the first usable token, streamed answers only. Buckets 0.05 s to 60 s. |
| `opod_request_tokens_total`        | counter   | `model`, `direction`           | Tokens served; `direction` is `prompt` or `completion`.                        |

### Nodes and models

| Series              | Type  | Labels             | Meaning                                                                                               |
| ------------------- | ----- | ------------------ | ----------------------------------------------------------------------------------------------------- |
| `opod_node_up`      | gauge | `node`, `hostname` | 1 when the node heartbeated recently.                                                                 |
| `opod_model_loaded` | gauge | `model`, `node`    | 1 when the model is loaded on the node.                                                               |
| `opod_worker_slots` | gauge | `node`             | Requests a worker's engine serves at once, from its heartbeat. Absent for a worker that reports none. |

Series of a node the leader forgets are deleted.

### Router

| Series                                 | Type      | Labels              | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------------- | --------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `opod_router_picks_total`              | counter   | `path`, `outcome`   | Dispatch decisions. `path`: `local`, `worker`, `shard`, `fallback-to-local`. `outcome`: `ok`; `none-reachable` (`worker`, `shard`); `store-error`, `no-workers`, `all-workers-stale` (`fallback-to-local`); and, for each worker skipped on the `worker` path, `error` (no node or no address), `draining`, `stale-heartbeat`, `engine-stopped` or `cooldown`.                                                                         |
| `opod_router_inflight`                 | gauge     | `node`              | In-flight requests per node, as the router sees them.                                                                                                                                                                                                                                                                                                                                                                                  |
| `opod_router_fallback_total`           | counter   | `op`, `reason`      | Fallback activations. `op`: `chat`, `embed`, `rerank`. `reason`: `primary-error` (a fallback model answered after the primary failed), `per-request` (the same, on a chain the request named), `retry` (a retry of one candidate, `opod.num_retries`), `next-worker` (the same model on another worker, after the first gave nothing), `context-length` or `content-policy` (the error's class swapped in that class's fallback list). |
| `opod_router_attempt_duration_seconds` | histogram | `model`, `outcome`  | Per-attempt duration.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `opod_router_cooldowns_active`         | gauge     | —                   | Workers in the circuit breaker's cooldown.                                                                                                                                                                                                                                                                                                                                                                                             |
| `opod_router_sticky_hits_total`        | counter   | `outcome`           | Sticky-session outcomes: `hit`, `miss`, `expired`.                                                                                                                                                                                                                                                                                                                                                                                     |
| `opod_router_hedge_total`              | counter   | `outcome`           | Hedged replicas: `win`, `cancelled`, `error`.                                                                                                                                                                                                                                                                                                                                                                                          |
| `opod_pd_handoff_total`                | counter   | `outcome`           | Prefill/decode handoffs: `split`, `retried`, or why not split (`penalty`, `penalty-unknown`, `engine`, `prefill-failed`, `no-prefill`, `pair-failing`: every prefill worker is held back as failing with this decode worker).                                                                                                                                                                                                          |
| `opod_pd_handoff_seconds`              | histogram | `prefill`, `decode` | Prefill/decode handoff time per pair of worker node ids: from the decode call's start to its first streamed event (the KV pull, the decode engine's slot wait and its first token). Only a streamed split that the decode engine served is observed; a non-streamed or `retried` request is not. Arrives in the core release after v0.4.8.                                                                                             |
| `opod_pd_transfer_bytes_total`         | counter   | `node`              | KV bytes this worker's engine moved for handoffs since it started (vLLM's NIXL connector, `vllm:nixl_bytes_transferred`). Per worker, not per pair: vLLM does not name the peer. Absent when the engine does not say. Arrives in the core release after v0.4.8.                                                                                                                                                                        |
| `opod_pd_transfer_seconds_total`       | counter   | `node`              | Seconds this worker's engine spent in KV transfers, summed (`vllm:nixl_xfer_time_seconds`). `rate(opod_pd_transfer_bytes_total) / rate(opod_pd_transfer_seconds_total)` is its transfer speed. Read it on decode workers: in vLLM's default pull mode the prefill worker reports 0. Absent when the engine does not say. Arrives in the core release after v0.4.8.                                                                     |
| `opod_pd_transfers_total`              | counter   | `node`              | KV transfers this worker's engine completed. Absent when the engine does not say. Arrives in the core release after v0.4.8.                                                                                                                                                                                                                                                                                                            |
| `opod_pd_kv_fetch_requests`            | gauge     | `node`, `stage`     | Requests on this worker waiting on a remote KV load, by stage: `waiting_to_start`, `in_progress` (the transfer), `loaded` (the KV is in place and the request waits for the decoder). A high `in_progress` is a slow transfer; a high `loaded` is a busy decoder. Absent when the engine does not say. Arrives in the core release after v0.4.8.                                                                                       |

### Admission

| Series                              | Type      | Labels            | Meaning                                                                                                                 |
| ----------------------------------- | --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `opod_admission_held_total`         | counter   | `outcome`         | Requests the admission hold handled: `served`, `shed_deadline`, `shed_cap`, `shed_evicted`, `cancelled`.                |
| `opod_admission_held`               | gauge     | `class`           | Requests waiting for capacity now.                                                                                      |
| `opod_admission_shed_total`         | counter   | `class`, `reason` | Held requests shed with `503`: `deadline`, `cap`, `evicted`, `unavailable`.                                             |
| `opod_admission_slot_waits_total`   | counter   | `class`           | Requests dispatched only after waiting for a free slot.                                                                 |
| `opod_admission_wait_seconds`       | histogram | `class`           | Wait at the admission gate; 0 when a slot was free.                                                                     |
| `opod_admission_in_flight`          | gauge     | `model`, `class`  | Requests dispatched and not yet complete.                                                                               |
| `opod_admission_slots`              | gauge     | `model`           | Slots the model can serve at once across its workers, lowered to what the KV pool holds when the plan states a context. |
| `opod_admission_ungoverned_workers` | gauge     | `model`           | Workers serving the model that report no slot count. While any serves, admission is unbounded.                          |

`class` is `critical`, `standard` or `sheddable`.

### Usage push

These series are new in core v0.4.0, with the [usage push](https://opod.io/docs/core-reference/streams/#usage-push). They are on the leader; a front door's records ride its push to the leader and are counted there.

| Series                           | Type    | Labels   | Meaning                                                                                                                                                                                                                     |
| -------------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `opod_usage_queue_bytes`         | gauge   |          | Bytes of encoded usage records the leader holds until a receiver takes them. `OPOD_USAGE_QUEUE_MB` is the cap.                                                                                                              |
| `opod_usage_queue_records`       | gauge   |          | Usage records the leader holds until a receiver takes them.                                                                                                                                                                 |
| `opod_usage_sent_total`          | counter |          | Usage records a receiver acknowledged with a 2xx.                                                                                                                                                                           |
| `opod_usage_export_errors_total` | counter |          | Pushes that failed: a network error or any status other than 2xx. The records stay queued and are sent again, except after a `400`.                                                                                         |
| `opod_usage_dropped_total`       | counter | `reason` | Usage records lost. `full`: the oldest, dropped to make room at the cap. `refused`: one record bigger than the whole queue. `rejected`: the receiver answered that it will never take them (a `400`, or a partial success). |

A receiver that is down shows as `opod_usage_queue_records` growing and `opod_usage_sent_total` flat. Alert on `increase(opod_usage_dropped_total[10m]) > 0`: from that moment usage is being lost. With no `OPOD_USAGE_OTLP_ENDPOINT` the queue fills to its cap and then drops; the leader says so once at start.

### Response cache

| Series                    | Type    | Labels |
| ------------------------- | ------- | ------ |
| `opod_cache_hits_total`   | counter | `path` |
| `opod_cache_misses_total` | counter | `path` |

On 0.2.1, `opod_callback_sent_total` (labels `sink`, `outcome`) and `opod_callback_queue_depth` (label `sink`) are declared but never incremented: no series appears. They are gone from 0.3.0.

### vLLM-named aliases

For an inference gateway whose endpoint picker reads vLLM's metric names, `/metrics` also carries three gauges with a `model_name` label set to the plan's model:

| Alias                       | Value                                                                          |
| --------------------------- | ------------------------------------------------------------------------------ |
| `vllm:num_requests_waiting` | Requests the engines report queued, summed over workers and gang coordinators. |
| `vllm:num_requests_running` | Leader in-flight requests minus the queue above, floored at 0.                 |
| `vllm:kv_cache_usage_perc`  | KV-cache use as a fraction 0–1, the **mean** over reporting samples.           |

The worker part is recomputed at most once a second.

### Grafana

The repository ships three dashboards in `dashboards/`: cluster overview, per model and per node. Each binds to a Prometheus data source chosen at import.

## Traces

Set `observability.otlp_endpoint` or `OPOD_OTLP_ENDPOINT` to an OTLP/HTTP collector, for example `http://localhost:4318`. Empty means no tracing and no overhead. W3C `traceparent` propagation is always on.

A collector that wants a token, or sits behind a path, works from core v0.4.7: `OPOD_OTLP_HEADERS=Authorization=Bearer <collector token>` is sent on every trace and log export, and a URL path is kept as a prefix (`https://gw.example.com/otel` posts to `…/otel/v1/traces` and `…/otel/v1/logs`). In core v0.4.6 the leader sends no header and uses the host and port only. See [Environment](https://opod.io/docs/core-reference/environment/).

```text
http.request
└── router.Chat                      (covers the whole stream)
    ├── router.Chat.attempt          (one per candidate or retry)
    │   └── <engine>.Chat            (ollama, vllm, sglang, mlx, llamacpp, trtllm)
    └── …
http.request
└── router.Embed
    └── router.Embed.attempt
        └── <engine>.Embed
```

| Span                          | Attributes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `router.Chat`, `router.Embed` | `opod.model.requested`, `opod.fallback.chain_length`, `opod.fallback.source` (where the chain came from, e.g. `catalog`), `opod.fallback.used_at`, `opod.model.served`, `opod.stream.events`; `opod.sort` with a sort override; `opod.latency.reordered` and `opod.latency.front` when the latency fallback moved a faster model first; `opod.retry.num_retries` and `opod.retry.backoff_ms` with a retry override; `opod.fallback.classifier` (the error class) when a typed fallback chain was considered |
| `router.Chat.hedged`          | `opod.model.requested`, `opod.hedge.replicas`, `opod.hedge.candidates`, `opod.hedge.winner` (the node that answered first). With fewer than 2 candidates the request falls through to `router.Chat`.                                                                                                                                                                                                                                                                                                        |
| `router.Chat.attempt`         | `opod.attempt`, `opod.model.candidate`, `opod.is_fallback`, `opod.engine`, `opod.node_id`, and when recording `opod.gang.id`, `opod.class`                                                                                                                                                                                                                                                                                                                                                                  |
| `<engine>.Chat`               | `opod.engine`, `opod.model`, `opod.engine.endpoint`, `opod.messages`, `http.status_code`, `opod.tokens.prompt`, `opod.tokens.completion`, `opod.tokens.cached`                                                                                                                                                                                                                                                                                                                                              |

Spans carry no key, user or team. Every engine call carries the trace on through the worker into the engine, so an engine that exports its own spans (vLLM with `--otlp-traces-endpoint`) joins the caller's trace. A cell door starts no span and passes `traceparent` through.

`OPOD_TRACE_SAMPLE_RATIO` (0–1, default 1) samples the traces the leader starts, by trace id. A request with a `traceparent` follows its caller's decision.

## Logs

The leader and workers write JSON log lines (`slog`) to stderr. `log_level`: `debug`, `info` (default), `warn`, `error`.

`OPOD_OTLP_LOGS_ENDPOINT` also sends the leader's own records to an OTLP/HTTP collector, beside stderr, under the same `log_level`. Records carry `service.name=opod` and `service.version`. The queue holds 2048 records; a slow or absent collector costs the oldest queued records, never a request. A bad endpoint, or (from core v0.4.7) an `OPOD_OTLP_HEADERS` part that is not `k=v`, is a warning at start, not a failure. The same holds for traces from that release: an unusable trace endpoint or header logs `tracing disabled` and the leader still starts. Engine output is not exported; collect it from the host or the container.

The policy snapshot's `logging.accessLog` switches the leader's access log on or off at runtime.
