LLM Metrics
Track LLM request latency, token usage, and billed spend across providers and models. See Labels for request and agent dimensions.
Metrics
| Metric | Type | Extra Labels | Measures |
|---|---|---|---|
llm_ | Histogram | status_ | Upstream-call latency; streaming measures establishment, not completion. Retries can add observations. |
llm_ | Histogram | provider, operation, stream, outcome, error_, status_ only | End-to-end logical proxy and unified model API inference duration, including preflight, retries, and full stream completion |
llm_ | Counter | type (input, output) | Tokens used. input excludes prompt-cache tokens. |
llm_ | Counter | cache_ (read, write) | Prompt-cache tokens read from or written to the provider cache |
llm_ | Histogram | Input plus output tokens per request | |
llm_ | Counter | billing_, auth_ | Estimated list-price cost in USD. Needs model pricing. |
llm_ | Counter | Cost in USD of prompt-cache reads and writes | |
llm_ | Counter | USD saved by cache reads at the discounted price | |
llm_ | Histogram | Streaming: from the upstream call to the provider's first chunk | |
llm_ | Histogram | Streaming: from request receipt to the first byte sent to the client | |
llm_ | Histogram | Output token throughput | |
llm_ | Counter | Tool calls blocked by guardrails | |
agent_ | Counter | external_ | Unique runs, counted by the X-Archestra-Run-Id header |
llm_ | Gauge | window (24h, 7d) only | Distinct users with at least one LLM request in the window |
Billing and Authentication Labels
billing_ is metered for per-token billing and subscription for flat-rate subscription credentials. Billed spend is sum(llm_cost_total{billing_mode="metered"}). auth_ is provider_, virtual_, passthrough_, jwks, oauth_, oauth_, internal, or unknown.
Streaming Latency
For one request, the difference between client first-byte and upstream first-chunk times includes work before the upstream call, such as authentication and guardrails. Do not subtract aggregate percentiles to estimate that duration.
Active User Aggregation
Every replica reports the same llm_ value, so aggregate it with max(), not sum(). ARCHESTRA_ sets the refresh interval; 0 turns the metric off.
Trace Exemplars
Upstream LLM latency, token, cache, and cost observations can carry trace exemplars. See Exemplars for collection requirements.
Proxy Request Outcomes
Track end-to-end request outcomes, throttling, and latency across the LLM Proxy and unified model API with llm_, separating Archestra policy decisions from upstream provider and client failures.
Each observation records one logical inference request from handler entry through completion, including preflight, retries, failovers, and the full response stream. Use llm_ as the request counter; Archestra does not emit a separate counter metric. Use the existing llm_ for upstream-call latency: its count can include retries, and misses preflight refusals and failures after streaming headers.
The metric covers inference requests handled by the shared proxy and unified model API. It excludes requests rejected by authentication or validation before reaching those handlers, model listing, unsupported passthrough endpoints, and provider file routes.
| Label | Values |
|---|---|
provider | Resolved provider name (such as openai or anthropic), or router when a unified-model request fails before routing selects a provider |
operation | Inference operation, such as chat, generate_, or embedding |
stream | true or false |
outcome | success, incomplete, error, throttled, denied, cancelled, timeout, or overloaded |
error_ | none for success or incomplete, archestra, provider, or client |
status_ | HTTP response status code (100–599, normalized to 500 if invalid, or 499 when the client disconnects before headers are sent) |
incomplete identifies a provider terminal such as an output-token limit; it has no error origin.
If a streaming request fails after HTTP 200 headers are sent, status_ stays 200 while outcome and error_ record the midstream failure. To keep cardinality bounded, this histogram carries only the six labels above and omits model, agent, user, team, and key dimensions. For per-request attribution, use the metadata-only archestra.llm_proxy.request OpenTelemetry log event in Proxy Request Log Events; existing token, cache, and cost metrics above, costs and limits, and LLM spans keep their existing dimensions.
Scrape Archestra's standard /metrics endpoint to collect this histogram, and query llm_ for throttle and error rates:
# Upstream provider rate limits (requests/sec by provider)
sum by (provider) (
rate(llm_proxy_request_duration_seconds_count{outcome="throttled", error_origin="provider"}[5m])
)
# Internal Archestra throttles and policy or limit denials (requests/sec)
sum by (outcome) (
rate(llm_proxy_request_duration_seconds_count{outcome=~"throttled|denied", error_origin="archestra"}[5m])
)
# Non-success request rate by origin and outcome, including midstream 200 failures
sum by (provider, error_origin, outcome) (
rate(llm_proxy_request_duration_seconds_count{outcome!="success"}[5m])
)