Metrics Reference
AISIX exposes operational metrics in Prometheus text format. A Prometheus server or another compatible collector can scrape these metrics for dashboards, alerts, and PromQL queries.
Prometheus metrics are enabled by default on a dedicated listener. The default startup configuration is:
observability:
metrics:
prometheus:
enabled: true
addr: 0.0.0.0:9090
path: /metrics
Prometheus scrapes GET /metrics from this listener.
The metrics endpoint is unauthenticated by design. Keep its listener private to your monitoring network.
AISIX publishes configuration status whenever the endpoint is scraped. Other metric families are registered when AISIX first records the corresponding activity, so traffic metrics might not appear immediately after startup. Send a request through the proxy, then scrape again for the corresponding series to appear.
The catalog lists default labels. To add or remove labels per metric, see Metric Labels and Variables.
Metrics Catalog
Search metric names, descriptions, labels, and values, or filter the catalog by family and type. Expand an entry to review its details.
- Metrics
- 84
- Families
- 12
Metric Types
A cumulative value that increases until the process restarts, such as a request or token total. Use rate() to calculate how quickly it changes.
A current value that can increase or decrease, such as active requests or remaining quota.
Observations counted in configurable buckets. The _bucket, _sum, and _count series can be aggregated before calculating a percentile.
Observations with quantiles calculated by each gateway instance. Summaries also expose _sum and _count, but their quantiles cannot be aggregated across instances.
Request Metrics
Track request outcomes and the work currently in progress at the proxy.
Detailed Request Labels
Every client-facing route records this family: the model endpoints, /v1/models, the OAuth protected-resource discovery documents, MCP, A2A and its agent card, the file, batch, and fine-tuning routes, realtime sessions, and passthrough routes. A request the gateway refuses during authentication with 401 or 403 is counted too, with model="unresolved", on every route that authenticates its caller this way: the model endpoints, /v1/models, the file, batch, and fine-tuning routes, MCP, and A2A. The /livez and /readyz probes are not counted. /v1/models, the discovery documents, the agent card, and authentication refusals are not counted by 1.7.1 or earlier.
Every counter in this family samples once per client request, and its status is the status the request ended on. For a streamed response that is the status the stream ended with — 499 for a caller that left mid-stream, 502 or 504 for an upstream that broke or timed out — and the sample is taken when the stream ends, so a rate() lags by about one stream length during a burst of long streams. A request whose first target failed and whose fallback then succeeded is a single status="200" sample here; the failure it recovered from is not represented in this family at all. Count upstream attempts with the deployment metrics and read individual attempts in the usage log.
For the three detailed request counters, stream records whether the client requested streaming. is_fallback records whether a fallback target served the request. error_source distinguishes a provider-side failure from one decided or caused by AISIX; it is empty on a success or caller disconnect. is_fallback and error_source do not appear on latency metrics. The label follows the request's result rather than its status: an MCP tools/call or A2A call that fails behind an HTTP 200 can record status="200" with error_source="upstream", or with error_source="aisix" when the gateway refused or could not make an MCP call itself. Filter on error_source as well as status when you count failures.
provider_key_name and user_name are human-readable companions to their IDs. A provider key name is one-to-one with its ID. user_name comes from the member document when one is present; an empty name there reports unknown. Only when the document is absent does it fall back to the API key's own user_name. Separate API keys can associate the same user_id with different fallback names, creating separate series.
The detailed request counters also accept api_key_name and team_name, the display names of the authenticating API key and of its team. Neither is a default label: add them to a family's list in observability.metrics.labels. A key without a display name, or a team whose name the gateway has not received, reports unknown, and a rename starts a new series. Not emitted by 1.5.0 or earlier.
A failed request carries the same provider, upstream_model, and provider-key labels as a successful one, so a failure rate per provider or per provider key is computable from this family alone. The upstream labels report the last target the request selected: under retry or failover that is the attempt whose error the caller received. They report unknown only when the request never selected a target — an unknown model, an input guardrail block, a budget refusal, or a body refused before dispatch.
inbound_protocol is a bounded protocol family derived from the normalized endpoint. The Anthropic-protocol endpoints report anthropic. The MCP endpoints report mcp: /mcp, /mcp/{server} and the sign-in routes under it, /mcp-oauth/ routes, and the root-level OAuth discovery documents, /.well-known/oauth-protected-resource, /.well-known/oauth-protected-resource/mcp, /.well-known/oauth-protected-resource/mcp/{server}, and /.well-known/oauth-authorization-server/mcp/{server}. /a2a and the A2A agent card, /v1/realtime, and /passthrough_route report a2a, realtime, and passthrough, and the remaining gateway endpoints report openai. The in-flight gauge uses the same values. 1.10.0 and earlier report the root-level discovery documents as openai.
upstream_protocol is the other half of that pair: the protocol AISIX spoke to the upstream that served the request. It is resolved from the selected target's Provider Key by the same rule dispatch uses, so it reports the wire shape the request was actually converted to — openai, anthropic, bedrock, vertex, or azure-openai — and unknown when the request selected no upstream at all. Group by both labels to separate native traffic from cross-protocol conversion; see Separate Cross-Protocol Conversion Traffic.
Do not substitute provider for upstream_protocol. provider is an open vendor string, and the same vendor can be reached through different adapters, so a PromQL mapping from vendor names to protocols has to be maintained by hand and silently misreports every custom or OpenAI-compatible vendor.
endpoint is always a normalized route template, never a raw request path. Routes with a path parameter collapse to one series — /v1/batches/:id, /v1/videos/:id, and /mcp/{server} — while paths under /passthrough/ use /passthrough_route and an unrecognized path reports other. The two discovery documents are /.well-known/oauth-protected-resource and /.well-known/oauth-protected-resource/mcp, and an A2A agent card is /a2a/{agent}/.well-known/agent-card.json, apart from the /a2a agent calls. The routes of an MCP server that signs users in have their own templates: /.well-known/oauth-protected-resource/mcp/{server}, /.well-known/oauth-authorization-server/mcp/{server}, /mcp/{server}/.well-known/openid-configuration, /mcp/{server}/.well-known/jwks.json, /mcp/{server}/oauth/register, /mcp/{server}/oauth/authorize, /mcp/{server}/oauth/token, /mcp/{server}/oauth/credential, /mcp-oauth/callback, /mcp-oauth/login/callback, and /mcp-oauth/consent. Any other path under /mcp/{server}/ reports other.
aisix_requests_total . Description: Proxy request outcomes in the compatibility series with the broadest endpoint coverage. . Type: counter . Label count: 4 labels
Labels
provider, model, status, outcomeValues for outcome
success, client_error, rate_limited, upstream_errorsuccess covers HTTP 200–399, client_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
Behavior
A2A agent calls use provider="a2a" and model="a2a".
PromQL example
sum(rate(aisix_requests_total[5m])) by (outcome)aisix_llm_requests_total . Description: Model-inference request outcomes, including successful and failed requests. . Type: counter . Label count: 17 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_name, stream, is_fallback, status, outcome, error_sourceValues for inbound_protocol
openai, anthropic, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Values for stream
false, trueValues for is_fallback
false, trueValues for outcome
success, client_error, rate_limited, upstream_errorsuccess covers HTTP 200–399, client_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
Values for error_source
aisix, upstream, upstream means the provider returned an error or its call failed. aisix means the gateway rejected or failed the request itself, including rate limits, budgets, and guardrail blocks. An empty value means the request succeeded or the caller disconnected. The request's final result decides the value: a request that recovers through a fallback is empty, and otherwise the last target's failure names it.
Behavior
Covers the endpoints that call a model: chat-completions, completions, messages, count-tokens, responses, embeddings, rerank, /v1/systemone and /v1/decisions, audio, image generation and editing, videos, and realtime sessions. Requests that reach no model are counted in aisix_proxy_requests_total only — MCP tool calls, A2A agent calls and agent cards, opaque passthrough relays, the file, batch, and fine-tuning management routes, /v1/models, and the OAuth discovery documents.
A passthrough-route request is counted here, with endpoint="/passthrough_route", when AISIX identifies its protocol as one a model endpoint serves: chat, Anthropic Messages, responses, completions, embeddings, image generation or editing, or rerank. Its model is the request body's model collapsed to a configured model name, unresolved when it names none, or unknown when the body has no model, and its upstream_model is unknown. The same model applies to its samples in the proxy request families. Other passthrough requests, including DashScope native bodies, are counted in the proxy families only, with model="passthrough".
A request refused before dispatch, such as an oversized body, is counted against the endpoint it targeted, so a success rate over an endpoint includes those failures in its denominator.
aisix_proxy_requests_total . Description: Detailed request outcomes for all proxied traffic, model-inference and otherwise. . Type: counter . Label count: 17 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_name, stream, is_fallback, status, outcome, error_sourceValues for inbound_protocol
openai, anthropic, mcp, a2a, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Values for stream
false, trueValues for is_fallback
false, trueValues for outcome
success, client_error, rate_limited, upstream_errorsuccess covers HTTP 200–399, client_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
Values for error_source
aisix, upstream, upstream means the provider returned an error or its call failed. aisix means the gateway rejected or failed the request itself, including rate limits, budgets, and guardrail blocks. An empty value means the request succeeded or the caller disconnected. The request's final result decides the value: a request that recovers through a fallback is empty, and otherwise the last target's failure names it.
Behavior
One sample per client request, carrying the status the request ended on. Retries and failovers within a request do not add samples, so this counter answers "how many requests did callers make, and how did they end" — not "how many calls did the gateway place upstream".
aisix_proxy_failed_requests_total . Description: The subset of proxy requests whose outcome is not success. . Type: counter . Label count: 17 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_name, stream, is_fallback, status, outcome, error_sourceValues for inbound_protocol
openai, anthropic, mcp, a2a, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Values for stream
false, trueValues for is_fallback
false, trueValues for outcome
client_error, rate_limited, upstream_errorclient_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
Values for error_source
aisix, upstream, upstream means the provider returned an error or its call failed. aisix means the gateway rejected or failed the request itself, including rate limits, budgets, and guardrail blocks. An empty value means the request succeeded or the caller disconnected. The request's final result decides the value: a request that recovers through a fallback is empty, and otherwise the last target's failure names it.
aisix_proxy_in_flight_requests . Description: Requests currently being handled by the proxy, grouped by normalized endpoint and inbound protocol. . Type: gauge . Label count: 2 labels
Labels
endpoint, inbound_protocolValues for inbound_protocol
openai, anthropic, mcp, a2a, realtime, passthroughBehavior
MCP requests use inbound_protocol="mcp", with endpoint="/mcp" for the aggregated gateway and endpoint="/mcp/{server}" for the per-server endpoint. A2A calls use endpoint="/a2a" and inbound_protocol="a2a". An agent card fetch uses endpoint="/a2a/{agent}/.well-known/agent-card.json".
Requests normalized to endpoint="/passthrough_route" use inbound_protocol="passthrough".
PromQL example
sum(aisix_proxy_in_flight_requests) by (endpoint, inbound_protocol)aisix_proxy_client_cancelled_requests_total . Description: Requests whose caller disconnected before the gateway sent response headers. . Type: counter . Label count: 4 labels
Labels
endpoint, model, provider_key_id, provider_key_nameBehavior
These requests never reach a normal outcome, so they do not appear in the other request counters. The gateway records them here and in the access log with status 499.
A rising rate usually means callers give up while waiting for the first token. Break the series down by model and compare it against aisix_llm_time_to_first_token_seconds for the same model.
model is the model the caller addressed, and the provider-key labels identify the target the request was waiting on. A caller that disconnects before the gateway resolves them — during the request body upload, for example — reports unknown for all three.
The caller identity, status, and outcome labels of the other request counters are deliberately absent. A cancelled request has no status and often no team or user, so those dimensions would be unknown on every sample.
A caller that disconnects after response headers were sent is not counted here. That request already has a normal outcome and a usage event.
PromQL example
sum(rate(aisix_proxy_client_cancelled_requests_total[5m])) by (endpoint, model)aisix_proxy_request_body_limit_rejections_total . Description: Requests refused for exceeding proxy.request_body_limit_bytes, grouped by how the gateway finished reading the refused body. . Type: counter . Label count: 3 labels
Labels
endpoint, inbound_protocol, outcomeValues for inbound_protocol
openai, anthropic, mcp, a2a, realtime, passthroughValues for outcome
completed, cap_reached, timeout, client_read_errorcompleted means the caller sent the whole body it declared, so it could read the 413. cap_reached and timeout mean the gateway stopped absorbing the body first, and client_read_error means the caller went away mid-body — in all three the caller usually sees a closed connection instead of the response.
Behavior
The gateway reads and discards the body of a refused request so the caller can receive the 413 on the same connection. That read is bounded, and outcome reports how it ended.
A rising share of any outcome other than completed means callers are seeing closed connections instead of 413 responses. The matching aisix::body_limit log entry carries the declared size, the configured limit, and the bytes read for the same request_id.
Only requests that declare a Content-Length over the limit are counted here. A chunked body over the limit is rejected while it is being read, has no comparable outcome, and appears in aisix_requests_total with status 413.
PromQL example
sum(rate(aisix_proxy_request_body_limit_rejections_total[5m])) by (endpoint, inbound_protocol, outcome)aisix_auth_decisions_total . Description: Caller authentication decisions across API key, JWT, and missing-credential paths. . Type: counter . Label count: 3 labels
Labels
method, result, reasonValues for method
api_key, jwt, none, mcp_oauth_session, mcp_oauth_loginValues for result
allowed, deniedBehavior
reason is none for an allowed request. Denied requests use a bounded reason such as missing_credentials, unknown_key, key_expired, jwt_bad_signature, jwt_untrusted_issuer, or jwt_identity_unmapped.
mcp_oauth_session is a gateway session token presented on /mcp/{server}, and mcp_oauth_login is a browser sign-in. Their denied reasons include session_invalid, session_wrong_server, session_key_absent, session_provider_gone, session_identity_changed (the identity value recorded for the session no longer matches the provider's identity_claim, or an upstream callback was refused because identity_claim changed during the sign-in), session_issuer_changed (the provider's issuer is no longer the one that signed the user in), nonce_mismatch, and mcp_acl_denied.
PromQL example
sum(rate(aisix_auth_decisions_total{result="denied"}[5m])) by (method, reason)Latency Metrics
Inspect latency on one gateway or aggregate histogram buckets across gateway instances.
Latency Aggregation and Labels
Use histograms for service-level dashboards and alerts across gateway instances because their _bucket, _sum, and _count series can be aggregated before using histogram_quantile(). Use summaries to inspect precomputed quantiles from one gateway instance. Summary quantiles cannot be aggregated across instances, so do not average them.
Each histogram has its own bucket boundaries, because the two distributions differ: end-to-end latency starts in the milliseconds, while time to first token cannot be faster than the upstream that produces the token. Both sets are configurable. env_id is the configured environment ID. AISIX Enterprise and AISIX Cloud set it for managed gateways, and AISIX OSS configured through etcd can set it explicitly; it is unknown when unset. status_class is one of 2xx, 3xx, 4xx, 5xx, or other. Per-key and per-user labels are excluded to keep the number of bucket series manageable; use usage analytics for those dimensions.
The two duration summaries, aisix_llm_time_to_first_token_seconds, and both histograms also accept api_key_name and team_name, the display names of the authenticating API key and of its team, when they are added to the family's list in observability.metrics.labels. Neither is a default label. A key without a display name, or a team whose name the gateway has not received, reports unknown, and a rename starts a new series. Not emitted by 1.5.0 or earlier.
aisix_request_duration_seconds . Description: Request duration across proxy endpoints in the compatibility series. Streamed HTTP responses record the whole stream, under the status the stream ended on. Realtime records the full WebSocket session until it closes. . Type: summary . Label count: 3 labels
Labels
provider, model, statusBehavior
Summary quantiles are calculated by each AISIX instance and cannot be aggregated across instances.
aisix_llm_request_duration_seconds . Description: Detailed request duration for model-inference endpoints. Streamed HTTP responses record the whole stream, under the status the stream ended on. Realtime records the full WebSocket session until it closes. . Type: summary . Label count: 15 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_name, stream, status, outcomeValues for inbound_protocol
openai, anthropic, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Values for stream
false, trueValues for outcome
success, client_error, rate_limited, upstream_errorsuccess covers HTTP 200–399, client_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
aisix_proxy_request_duration_seconds . Description: Detailed request duration for all proxied traffic. Streamed HTTP responses record the whole stream, under the status the stream ended on. Realtime records the full WebSocket session until it closes. . Type: summary . Label count: 15 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_name, stream, status, outcomeValues for inbound_protocol
openai, anthropic, mcp, a2a, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Values for stream
false, trueValues for outcome
success, client_error, rate_limited, upstream_errorsuccess covers HTTP 200–399, client_error covers HTTP 400–499 except 429, rate_limited is every HTTP 429 (a gateway rate limit, a budget refusal, or an upstream's own 429), and all other statuses map to upstream_error.
aisix_llm_time_to_first_token_seconds . Description: Time to the first streamed frame for every streamed response: chat-completions, messages, and responses, streamed audio transcriptions and translations, streamed A2A calls, and passthrough-route streams. The side label separates the upstream interval from the one the client waited for. . Type: summary . Label count: 13 labels
Labels
side, endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for side
upstream, downstreamupstream is the time from the start of the attempt that served the request to the first upstream frame of any type. downstream is what the client waited for: from the gateway receiving the request to the first frame written to the client. Always emitted; a label selection cannot remove it.
Values for inbound_protocol
openai, anthropic, a2a, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Behavior
A query that does not filter on side blends both intervals, so select side="upstream" for the upstream view.
The downstream interval spans request parsing, input guardrails, failed attempts and their backoff, and output-guardrail hold-back. On a request served by its first attempt, downstream minus upstream is gateway-side work, typically guardrails; on a retried request it also contains the earlier attempts.
Downstream observations are a subset of upstream ones. A stream blocked by an output guardrail before its first frame reached the client, or abandoned during hold-back, records only an upstream observation.
On /v1/messages with a non-Anthropic upstream, and on /v1/responses with a chat-protocol upstream, the client's first frame is the first content-bearing event. The downstream interval there also includes that wait, which for a reasoning upstream is its thinking time.
Passthrough-route streams are recorded under endpoint="/passthrough_route": a reply whose protocol AISIX identifies, and an opaque relay, timed to its first frame of bytes.
Streamed A2A calls are recorded under endpoint="/a2a". A response that is not streamed records nothing here, and neither does /v1/audio/speech, whose chunked audio body is not a stream of tokens, or a realtime session.
aisix_request_e2e_latency_seconds . Description: End-to-end latency of every request the request metrics count, including the full duration of streams, except realtime sessions. . Type: histogram . Label count: 7 labels
Labels
side, env_id, endpoint, model, provider, status_class, streamingValues for side
upstream, downstreamdownstream is the client-perceived latency this histogram recorded before the label existed. upstream is the upstream duration of the attempt that produced the response, the same figure as that attempt's upstream_latency_ms usage-event field. Always emitted; a label selection cannot remove it.
Values for status_class
2xx, 3xx, 4xx, 5xx, otherValues for streaming
false, trueBehavior
Default buckets range from 5 milliseconds to 600 seconds, and are configurable with observability.metrics.buckets.request_e2e_latency. The low boundaries record fast responses such as cache hits and requests rejected before dispatch. Aggregate _bucket series before calculating percentiles across gateway instances.
The downstream side is recorded on every route that records the request metrics, with the same endpoint: the model endpoints, /v1/models, the OAuth discovery documents, MCP, A2A and its agent card, the file, batch, and fine-tuning routes, and passthrough routes, including requests refused during authentication or before dispatch. /v1/realtime is the exception: a WebSocket session has no request and response to time.
Each request is observed once. Non-streaming requests and failures are recorded when the handler returns. Streaming requests are recorded when the stream finishes, including client cancellation; a canceled stream records 499 and the duration up to cancellation, and a stream the upstream broke or timed out records its 502 or 504. A caller that disconnects before response headers were sent is counted in aisix_proxy_client_cancelled_requests_total only and records nothing here. /v1/videos/:id/content is recorded when the video body has been relayed to the client, under the status of its response head.
A2A calls use endpoint="/a2a" and record the agent-call lifetime, including the complete stream; an abandoned A2A stream records 499 in the 4xx status class.
The observations described above are side="downstream". A query that does not filter on side blends both sides, and the upstream samples pull its percentiles down, so select side="downstream" for the client-perceived figure.
A request records at most one side="upstream" observation, with the same labels as its downstream one apart from side. It measures the attempt that produced the response, from its start until the upstream settled: the response fully received, or for a stream the end of the upstream stream. It is recorded whenever that attempt reached an upstream, including upstream errors and timeouts; on /a2a the attempt is the call to the agent. Cache hits, requests that failed before dispatch, ensemble models, and routes that report no attempt, such as /v1/models, the discovery documents, and the video status and content requests, record only the downstream side. Earlier failed attempts and their retry backoff appear only in the downstream figure.
PromQL example
histogram_quantile(
0.90,
sum by (le) (rate(aisix_request_e2e_latency_seconds_bucket{side="downstream"}[5m]))
)aisix_request_ttft_seconds . Description: Time to the first streamed frame for every streamed response: chat-completions, messages, and responses, streamed audio transcriptions and translations, streamed A2A calls, and passthrough-route streams. The side label separates the upstream interval from the one the client waited for. . Type: histogram . Label count: 7 labels
Labels
side, env_id, endpoint, model, provider, status_class, streamingValues for side
upstream, downstreamupstream is the time from the start of the attempt that served the request to the first upstream frame of any type. downstream is what the client waited for: from the gateway receiving the request to the first frame written to the client. Always emitted; a label selection cannot remove it.
Values for status_class
2xx, 3xx, 4xx, 5xx, otherValues for streaming
trueBehavior
On the upstream side, the first upstream frame stops the timer even when it carries no visible generated output, such as a role-only opener or an Anthropic message_start event. Content, reasoning, and tool-call frames also stop it.
A query that does not filter on side blends both intervals, so select side="upstream" for the upstream view.
The downstream interval spans request parsing, input guardrails, failed attempts and their backoff, and output-guardrail hold-back. On a request served by its first attempt, downstream minus upstream is gateway-side work, typically guardrails; on a retried request it also contains the earlier attempts.
Downstream observations are a subset of upstream ones. A stream blocked by an output guardrail before its first frame reached the client, or abandoned during hold-back, records only an upstream observation.
On /v1/messages with a non-Anthropic upstream, and on /v1/responses with a chat-protocol upstream, the client's first frame is the first content-bearing event. The downstream interval there also includes that wait, which for a reasoning upstream is its thinking time.
Passthrough-route streams are recorded under endpoint="/passthrough_route": a reply whose protocol AISIX identifies, and an opaque relay, timed to its first frame of bytes.
Streamed A2A calls are recorded under endpoint="/a2a". A response that is not streamed records nothing here, and neither does /v1/audio/speech, whose chunked audio body is not a stream of tokens, or a realtime session.
Default buckets range from 50 milliseconds to 300 seconds, and are configurable with observability.metrics.buckets.request_ttft. Lower the first boundaries when a nearby model server can produce output in under 50 milliseconds. Deployments that use only hosted providers can raise the floor to remove consistently empty buckets.
PromQL example
# P90 upstream TTFT
histogram_quantile(
0.90,
sum by (le) (rate(aisix_request_ttft_seconds_bucket{side="upstream"}[5m]))
)
# P90 client-side TTFT, to compare with the upstream P90
histogram_quantile(
0.90,
sum by (le) (rate(aisix_request_ttft_seconds_bucket{side="downstream"}[5m]))
)Usage and Cost Metrics
Measure token volume and normalized client usage.
Which Endpoints Report Tokens
Every endpoint that receives token counts from the upstream records them here: chat-completions, completions, messages, responses, embeddings, rerank, /v1/systemone and /v1/decisions, the audio transcription and translation routes, image generation and editing, and realtime sessions.
/a2a records the gateway's own count of the message text of message/send and message/stream calls — the counts its usage events flag with usage_estimated: true — like the estimated counts chat-completions records, and only for a call the agent received. Not emitted by 1.7.1 or earlier.
Nothing is recorded for /v1/messages/count_tokens, which consumes no tokens, for MCP tool calls, opaque passthrough relays, or the file and fine-tuning routes. Batch results are not recorded either: a completed batch's usage events still carry its tokens, but no mechanism makes a batch count exactly once across gateway replicas and restarts.
Passthrough routes record tokens here too, under endpoint="/passthrough_route", for a request whose protocol AISIX identifies as one of those endpoints' — chat, Anthropic Messages, responses, completions, embeddings, image generation or editing, or rerank — read the way that endpoint reads them. Their model is the request body's model collapsed to a configured model name, or unresolved. Not emitted by 1.6.0 or earlier.
Two model-inference endpoints report no tokens because they are not billed that way — /v1/audio/speech is billed per input character and /v1/videos per video. Both still count as requests, so divide token totals by requests only within one endpoint, never across all of them.
The per-request token series — the three aisix_llm_*_tokens_total counters — carry the same labels as the detailed request counters, so a query can join token volume to request outcomes on endpoint, model, provider, and the caller identity labels. The other two do not: aisix_tokens_consumed_total is labeled by provider and model only, and aisix_llm_tokens_by_client_total by client_type, model, and token_type.
The token and cache-token counters that carry the caller identity also accept api_key_name and team_name, the display names of the authenticating API key and of its team. Neither is a default label: add them to a family's list in observability.metrics.labels. A key without a display name, or a team whose name the gateway has not received, reports unknown, and a rename starts a new series. Not emitted by 1.5.0 or earlier.
Three further counters break out the tokens the upstream provider served from its own prompt cache. They carry the same labels as the token counters above, and each appears only once its value is non-zero, so a provider that reports no cache detail creates no series. They describe the **provider's** cache, not the AISIX response cache — that one is aisix_cache_requests_total under Cache Metrics, and the two are unrelated.
Providers report cache reads under two different accounting rules, which is why there are two read counters rather than one. aisix_llm_cached_input_tokens_total is the OpenAI shape, where the cached tokens are part of the reported prompt tokens and are therefore already inside aisix_llm_input_tokens_total. aisix_llm_cache_read_input_tokens_total and aisix_llm_cache_creation_input_tokens_total are the Anthropic shape, reported beside the input tokens rather than within them, so they are outside aisix_llm_input_tokens_total and inside aisix_llm_total_tokens_total.
Keeping them apart is what makes a cross-protocol query correct: the input a request really consumed is aisix_llm_input_tokens_total + aisix_llm_cache_read_input_tokens_total + aisix_llm_cache_creation_input_tokens_total, and the part of it served from cache is aisix_llm_cached_input_tokens_total + aisix_llm_cache_read_input_tokens_total. Both expressions hold for either provider shape. See Calculate Prompt Cache Hit Rate.
aisix_tokens_consumed_total . Description: The sum of total tokens across every endpoint that reports token usage, in the compatibility series with the broadest coverage. . Type: counter . Label count: 2 labels
Labels
provider, modelaisix_llm_input_tokens_total . Description: Input tokens AISIX attributes to the request. For model endpoints, AISIX normalizes provider-reported usage and estimates missing counts. AISIX estimates A2A input tokens from request text. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthrough, a2aValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
aisix_llm_output_tokens_total . Description: Output tokens AISIX attributes to the request. For model endpoints, AISIX normalizes provider-reported usage and estimates missing counts. AISIX estimates A2A output tokens from response text. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthrough, a2aValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
aisix_llm_total_tokens_total . Description: The cache-inclusive total tokens AISIX attributes to the request. For model endpoints, AISIX normalizes provider-reported usage and estimates missing counts. AISIX estimates A2A totals from request and response text. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthrough, a2aValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
aisix_llm_cached_input_tokens_total . Description: Input tokens the upstream served from its prompt cache and reported as part of its prompt token count. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Behavior
The OpenAI accounting shape: prompt_tokens_details.cached_tokens for OpenAI and OpenAI-compatible providers, prompt_cache_hit_tokens for DeepSeek, and cachedContentTokenCount for Gemini on Vertex AI. These tokens are already counted in aisix_llm_input_tokens_total, so adding the two together double-counts them.
Recorded only when the upstream reports the field. AISIX never infers a cache hit from response timing or prompt similarity.
aisix_llm_cache_read_input_tokens_total . Description: Input tokens the upstream served from its prompt cache and reported separately from its input token count. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Behavior
The Anthropic accounting shape: cache_read_input_tokens for Anthropic and cacheReadInputTokens for Amazon Bedrock. These tokens are **not** in aisix_llm_input_tokens_total, and they are in aisix_llm_total_tokens_total.
aisix_llm_cache_creation_input_tokens_total . Description: Input tokens the upstream wrote into its prompt cache. . Type: counter . Label count: 12 labels
Labels
endpoint, inbound_protocol, upstream_protocol, provider, model, upstream_model, provider_key_id, provider_key_name, api_key_id, team_id, user_id, user_nameValues for inbound_protocol
openai, anthropic, realtime, passthroughValues for upstream_protocol
openai, anthropic, bedrock, vertex, azure-openai, unknownThe protocol the gateway spoke to the upstream, which is independent of inbound_protocol. unknown means the request selected no upstream — a rejection before dispatch, or a route that calls no model.
Behavior
cache_creation_input_tokens for Anthropic and cacheWriteInputTokens for Amazon Bedrock. Like cache reads in the same shape, these tokens are outside aisix_llm_input_tokens_total and inside aisix_llm_total_tokens_total.
Providers bill cache writes above the standard input rate and cache reads well below it, so a workload that writes far more than it reads costs more than the same workload with caching switched off. Compare this counter with aisix_llm_cache_read_input_tokens_total to catch it.
aisix_llm_tokens_by_client_total . Description: Token volume across every endpoint that reports token usage, grouped by normalized client, requested model, and token type. . Type: counter . Label count: 3 labels
Labels
client_type, model, token_typeValues for client_type
openai-python, openai-node, anthropic-python, anthropic-typescript, claude-code, codex, cline, roo-code, kilocode, zoo-code, github-copilot, cursor, opencode, qwen-code, gemini-cli, crush, zed, aider, vercel-ai-sdk, langchain, llamaindex, litellm, curl, python-requests, httpx, aiohttp, okhttp, go-http-client, node, postman, browser, other, unknownAn unrecognized User-Agent maps to other; a missing User-Agent maps to unknown. Deployments can extend this set with admin-defined mapping rules (observability.metrics.client_type_rules). Full user-agent strings and versions remain in request logs and usage analytics.
Values for token_type
input, output, totaltotal includes input, output, and Anthropic cache-creation and cache-read tokens.
Behavior
model is the caller-requested model name, matching the model label on the aisix_llm_* token series. Routing, semantic, ensemble, and fallback dispatch retain this alias instead of reporting the selected direct model.
The bounded client_type allowlist prevents a client-controlled user-agent from creating unbounded Prometheus cardinality. Concrete model aliases are bounded by the configured model set, but a wildcard alias records each concrete model name requested through that pattern. Restrict wildcard access and monitor label growth when cardinality matters.
Admin-defined mapping rules (observability.metrics.client_type_rules) can classify additional clients. Rules are matched before the built-in allowlist and emit a fixed, validated label value, so the label set stays bounded.
Aggregated across all labels, the cache-inclusive total aligns with aisix_llm_total_tokens_total for the same endpoint population. Individual series do not align because the two metric families use different label sets; the dedicated client-type series avoids multiplying the per-key token series by another label dimension.
Anthropic reports cache tokens separately from input tokens, so total can exceed input plus output.
PromQL example
sum by (client_type, model, token_type) (
rate(aisix_llm_tokens_by_client_total[5m])
)Rate Limit and Budget Metrics
Monitor rate-limit rejections and the latest quota or budget state for each label set.
aisix_ratelimit_rejections_total . Description: Requests rejected by the shared rate-limit gate across proxy endpoints. . Type: counter . Label count: 3 labels
Labels
scope, layer, policy_idValues for scope
requests, tokensConcurrency-limit rejections use requests; the runtime does not emit a separate concurrency value.
Values for layer
api_key, model, mcp, policyBehavior
policy_id is empty outside layer="policy"; on the policy layer it carries the configured policy ID.
policy_name, the configured name of that same policy, can be added through observability.metrics.labels; it is not a default label. Like policy_id, it is empty outside layer="policy".
A shared Redis backing the limiter can fail without rejecting anything — the limiter silently falls back to per-replica counting. Those failures are counted by aisix_redis_failures_total under Cache Metrics.
aisix_ratelimit_remaining_requests . Description: Remaining request quota in the API key's rate-limit window, grouped by API key and model, refreshed when a request that resolved a model passes through the quota gate. . Type: gauge . Label count: 2 labels
Labels
api_key_id, modelBehavior
Refreshed on every route that resolves a model before the quota gate, whether the gate admits or rejects the request: the model endpoints, realtime sessions, and the file, batch, and fine-tuning routes, and a passthrough route when the request body names a configured model of the route's provider. Chat-completions refreshes it on a rejection at the gate and again after a successful response commits its tokens. MCP tool calls, A2A calls, and video status requests resolve no model and leave it unchanged.
model is the configured model the request resolved to — a wildcard alias reports the row, such as openai/*, not the concrete name the caller sent.
Retired to NaN within seconds of the API key being deleted, or of the model it reports no longer existing. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name, the API key's display name, can be added through observability.metrics.labels; it is not a default label, and a key without a display name reports unknown. Renaming the key starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_ratelimit_remaining_tokens . Description: Remaining token quota in the API key's rate-limit window, grouped by API key and model, refreshed when a request that resolved a model passes through the quota gate. . Type: gauge . Label count: 2 labels
Labels
api_key_id, modelBehavior
Refreshed on the same routes and at the same points as aisix_ratelimit_remaining_requests.
model is the configured model the request resolved to — a wildcard alias reports the row, such as openai/*, not the concrete name the caller sent.
Retired to NaN within seconds of the API key being deleted, or of the model it reports no longer existing. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name, the API key's display name, can be added through observability.metrics.labels; it is not a default label, and a key without a display name reports unknown. Renaming the key starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_budget_limit . Description: Budget limit, in the organization's currency. . Type: gauge . Label count: 4 labels
Labels
api_key_id, team_id, user_id, user_nameBehavior
Not emitted by 1.9.0 or earlier, which report the same amount as aisix_budget_limit_usd. A later gateway no longer emits aisix_budget_limit_usd: an observability.metrics.labels entry naming it is ignored, with a warning at startup. Rename the entry and update queries and alerts.
Removing a budget from a key does not zero this gauge — it holds the last budgeted value, which is why queries guard on aisix_budget_details_present == 1.
Retired to NaN within seconds of the API key being deleted, or rebound to another team or member. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name and team_name, the display names of the API key and of its team, can be added through observability.metrics.labels; neither is a default label, and an unresolved name reports unknown. Renaming the key or the team starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_budget_spent . Description: Budget spent, in the organization's currency. . Type: gauge . Label count: 4 labels
Labels
api_key_id, team_id, user_id, user_nameBehavior
Not emitted by 1.9.0 or earlier, which report the same amount as aisix_budget_spent_usd. A later gateway no longer emits aisix_budget_spent_usd: an observability.metrics.labels entry naming it is ignored, with a warning at startup. Rename the entry and update queries and alerts.
Removing a budget from a key does not zero this gauge — it holds the last budgeted value, which is why queries guard on aisix_budget_details_present == 1.
Retired to NaN within seconds of the API key being deleted, or rebound to another team or member. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name and team_name, the display names of the API key and of its team, can be added through observability.metrics.labels; neither is a default label, and an unresolved name reports unknown. Renaming the key or the team starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_budget_remaining . Description: Budget remaining, in the organization's currency. . Type: gauge . Label count: 4 labels
Labels
api_key_id, team_id, user_id, user_nameBehavior
Not emitted by 1.9.0 or earlier, which report the same amount as aisix_budget_remaining_usd. A later gateway no longer emits aisix_budget_remaining_usd: an observability.metrics.labels entry naming it is ignored, with a warning at startup. Rename the entry and update queries and alerts.
Removing a budget from a key does not zero this gauge — it holds the last budgeted value, which is why queries guard on aisix_budget_details_present == 1.
Retired to NaN within seconds of the API key being deleted, or rebound to another team or member. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name and team_name, the display names of the API key and of its team, can be added through observability.metrics.labels; neither is a default label, and an unresolved name reports unknown. Renaming the key or the team starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_budget_reset_seconds . Description: Seconds until the budget period resets. . Type: gauge . Label count: 4 labels
Labels
api_key_id, team_id, user_id, user_nameBehavior
Removing a budget from a key does not zero this gauge — it holds the last budgeted value, which is why queries guard on aisix_budget_details_present == 1.
Retired to NaN within seconds of the API key being deleted, or rebound to another team or member. NaN rather than 0 because 0 is a meaningful reading on this gauge; every comparison against it is false, so an alert on a retired series stops firing. An aggregation over a family containing one reads NaN too.
api_key_name and team_name, the display names of the API key and of its team, can be added through observability.metrics.labels; neither is a default label, and an unresolved name reports unknown. Renaming the key or the team starts a new series and retires the old one the same way. Not emitted by 1.5.0 or earlier.
aisix_budget_details_present . Description: Whether budget details are populated. . Type: gauge . Label count: 4 labels
Labels
api_key_id, team_id, user_id, user_nameValues for metric value
0, 11 means budget details are present; 0 means they have been cleared.
Behavior
api_key_name and team_name, the display names of the API key and of its team, can be added through observability.metrics.labels; neither is a default label, and an unresolved name reports unknown. Renaming the key or the team starts a new series. Not emitted by 1.5.0 or earlier.
Cache Metrics
Measure response-cache effectiveness per policy and watch the semantic layer’s embedding and store health.
Cache Hit Rate
Every request covered by an enabled cache policy with an available backend records one aisix_cache_requests_total observation. Requests with no matching policy or an unavailable backend are not counted — the gate never opened — so the series measures policy effectiveness, not total traffic.
Hit rate per policy: sum by (policy) (rate(aisix_cache_requests_total{outcome=~"hit_exact|hit_semantic"}[5m])) / sum by (policy) (rate(aisix_cache_requests_total[5m])). Split by outcome to see how much the semantic layer adds over exact matching.
Semantic-layer failures degrade to ordinary misses, which makes a broken embedding model or store indistinguishable from a healthy low hit rate in the outcome counter alone. Alert on aisix_cache_semantic_embedding_failures_total and aisix_cache_semantic_store_failures_total to separate the two.
aisix_cache_requests_total . Description: Cache-eligible requests by policy name and outcome, counted once per request when a matching enabled policy with an available backend opened the cache gate. . Type: counter . Label count: 2 labels
Labels
policy, outcomeValues for outcome
hit_exact, hit_semantic, miss, bypassbypass means the caller sent Cache-Control: no-cache, which skips the read path. no-store keeps the read path active, so it records an ordinary hit or miss and only suppresses a write after a miss.
aisix_cache_semantic_embedding_seconds . Description: Latency of the semantic layer’s embedding calls, per policy. Summary series without fixed buckets. . Type: summary . Label count: 1 label
Labels
policyaisix_cache_semantic_embedding_failures_total . Description: Embedding failures on the semantic layer. Failed requests proceed to the upstream uncached. . Type: counter . Label count: 2 labels
Labels
policy, causeValues for cause
resolve, embedresolve (embedding model missing or not an embedding model) is counted once per eligible request, including requests that then hit the exact layer; embed (provider call failed or timed out) is counted per embedding call.
aisix_cache_semantic_store_failures_total . Description: Semantic-store operation failures by operation. The in-process store cannot fail; shared (Redis) stores can. Failures degrade to an ordinary miss. . Type: counter . Label count: 2 labels
Labels
policy, opValues for op
lookup, storeaisix_redis_failures_total . Description: Failed operations against a Redis-backed store, counted once per failed operation. It covers every Redis-backed subsystem — the shared rate limiter, the exact response cache, and the semantic cache — because one deployment commonly points all of them at the same Redis. Not emitted by 1.1.0 or earlier releases. . Type: counter . Label count: 1 label
Labels
operationValues for operation
ratelimit_acquire, ratelimit_commit, ratelimit_peek, ratelimit_release, ratelimit_add_tokens, cache_get, cache_put, semantic_acquire, semantic_index, semantic_lookup, semantic_storeThe value names the subsystem as well as the call, so a deployment that points the limiter and the caches at one Redis can still tell which store is degraded.
Behavior
Every one of these failures degrades silently by design — the shared rate limiter falls back to per-replica counting, a cache read becomes a miss — so this counter is the only metric that reports the degradation. Most of them also log; the detached ratelimit_release and ratelimit_add_tokens operations do not, and the counter is their only trace.
Deployment Metrics
Monitor how each target model behaves: upstream attempts and their outcomes, fallbacks between targets, and whether a target remains in rotation.
Attempts, Not Requests
These counters sample once per upstream **attempt**, and each sample is filed under the target that was attempted rather than the Model Group the caller named. One client request that failed over across three targets is three samples here and one sample in the request metrics. Use this family to ask which target is failing, and the request family to ask what callers experienced.
Only attempts that reached the upstream are counted. An attempt the gateway refused on its own — the target was over its own rate limit, or its credentials or endpoint failed validation before anything was sent — produced no upstream response, so it is absent here while still appearing in the usage log. That keeps a misconfiguration from reading as an unhealthy target.
Emitted for every upstream attempt the model endpoints dispatch, to a direct model or to a Model Group's target, including the /v1/videos submission. The video status and content requests, realtime sessions, where a completed WebSocket upgrade counts as a success, and the file, batch, and fine-tuning routes record their upstream call here too. MCP tool calls, A2A calls, and passthrough routes call no configured model and record nothing here.
The two fallback counters come from the model endpoints' failover between targets. Realtime sessions, video status and content requests, and the file, batch, and fine-tuning routes call one target and never record a fallback.
aisix_deployment_requests_total, aisix_deployment_success_responses_total, aisix_deployment_failure_responses_total, and aisix_deployment_cooled_down_total also accept provider_key_name, the provider key's display name, when it is added to the family's list in observability.metrics.labels; it is not a default label here, and a rename starts a new series. aisix_deployment_state does not offer it: that gauge is written only when a target's health changes, so a renamed key would keep reporting its old name until the next transition. Not emitted by 1.5.0 or earlier.
aisix_deployment_requests_total . Description: Upstream attempts dispatched to a target model, whatever their outcome. . Type: counter . Label count: 4 labels
Labels
provider, model, upstream_model, provider_key_idPromQL example
sum(rate(aisix_deployment_requests_total[5m])) by (model)aisix_deployment_success_responses_total . Description: Upstream attempts a target model answered successfully. . Type: counter . Label count: 4 labels
Labels
provider, model, upstream_model, provider_key_idBehavior
For a streamed response, an attempt counts as successful once the upstream stream is established. A stream that breaks after that point is not reclassified here.
aisix_deployment_failure_responses_total . Description: Upstream attempts that failed at the target model, including the failures a fallback went on to rescue. . Type: counter . Label count: 4 labels
Labels
provider, model, upstream_model, provider_key_idPromQL example
sum(rate(aisix_deployment_failure_responses_total[5m])) by (model)
/ sum(rate(aisix_deployment_requests_total[5m])) by (model)aisix_routing_successful_fallbacks_total . Description: Fallback attempts that served the request after an earlier target failed. . Type: counter . Label count: 2 labels
Labels
model, fallback_modelBehavior
model is what the caller asked for — the Model Group name. fallback_model is the target the gateway moved to.
aisix_routing_failed_fallbacks_total . Description: Fallback attempts that failed in turn. . Type: counter . Label count: 2 labels
Labels
model, fallback_modelBehavior
A request rescued by its second fallback contributes one sample here and one to the successful family.
aisix_deployment_state . Description: Whether a target model is in rotation. . Type: gauge . Label count: 4 labels
Labels
provider, model, upstream_model, provider_key_idValues for metric value
0, 20 is healthy. 2 is out of rotation because the target is cooling down or failing a background health check.
aisix_deployment_cooled_down_total . Description: Number of times a target model entered cooldown. . Type: counter . Label count: 4 labels
Labels
provider, model, upstream_model, provider_key_idGuardrail Metrics
Track per-guardrail execution latency and outcomes, plus aggregate blocks and fail-open bypasses, across all endpoints.
Guardrail Execution Latency
Every timed guardrail execution records an aisix_guardrail_latency_seconds observation. A guardrail normally runs once per applicable phase, while streaming window scans can record several output executions for one response. The histogram uses configurable buckets that default to 1 ms through 30 s, so histogram_quantile yields P50/P95/P99 per guardrail.
The kind label identifies the configured guardrail implementation, and the result label separates fail-open bypasses (bypassed, with the failure tag in error_type) from policy decisions. A fail-closed evaluation failure surfaces as blocked; filter on error_type to distinguish it from a policy match.
The _count series doubles as a per-guardrail execution counter: sum by (guardrail, result) (rate(aisix_guardrail_latency_seconds_count[5m])) gives execution and block rates without a separate counter.
The aggregate counters cover guarded endpoints but count different units. aisix_guardrail_blocks_total counts rejected requests, while aisix_guardrail_bypasses_total counts bypass events, including proxy-raised passes before a guardrail member executes. They omit guardrail, kind, and phase labels; use the histogram _count series for timed execution dimensions.
aisix_guardrail_latency_seconds . Description: Wall-clock duration of one timed guardrail execution across all endpoints. guardrail is the configured guardrail name. . Type: histogram . Label count: 6 labels
Labels
env_id, guardrail, kind, phase, result, error_typeValues for kind
keyword, pii, aliyun_ai_guardrail, aliyun_text_moderation, azure_content_safety, azure_content_safety_text_moderation, bedrock, lakera, openai_moderation, presidio, semantic, customkeyword and pii run in-process. semantic calls a configured embedding model, custom runs the configured script, and the remaining kinds call moderation services.
Values for phase
input, outputValues for result
allowed, blocked, masked, bypassed, would_block, would_mask, would_mask_unsupportedbypassed is an evaluation failure that failed open; a fail-closed evaluation failure records as blocked. would_block / would_mask / would_mask_unsupported come from enforcement_mode: monitor guardrails. would_mask_unsupported is a mask rule that matched on a route that cannot rewrite content, such as a passthrough route; the same match on an enforcing guardrail records allowed, because the content was allowed through unmodified.
Values for error_type
none, aliyun_5xx, aliyun_config_error, aliyun_bad_response, aliyun_throttled, aliyun_timeout, azure_cs_5xx, azure_cs_config_error, azure_cs_throttled, azure_cs_timeout, bedrock_5xx, bedrock_throttled, bedrock_timeout, bedrock_too_large, lakera_5xx, lakera_config_error, lakera_throttled, lakera_timeout, lakera_too_large, openai_moderation_5xx, openai_moderation_config_error, openai_moderation_throttled, openai_moderation_timeout, openai_moderation_too_large, presidio_5xx, presidio_config_error, presidio_throttled, presidio_timeout, presidio_too_large, custom_timeout, custom_script_error, custom_engine_error, custom_no_verdict, custom_bad_verdict, custom_unknown_action, semantic_embed_unresolved, semantic_embed_timeout, semantic_embed_upstreamSet to the bounded failure tag when an evaluation failure produces result="blocked", result="bypassed", or a monitor-mode result="would_block"; otherwise none. The bypassed values are also used by aisix_guardrail_bypasses_total{reason}. That counter additionally uses unscannable_body and output_buffer_exceeded for proxy-raised passes that do not create a timed histogram observation.
Behavior
Default buckets: 0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, and 30 seconds, configurable with observability.metrics.buckets.guardrail_latency.
Monitor-mode executions record would_block / would_mask while the request proceeds, so a staged policy can be sized before enforcing it.
PII and keyword masking performed by synchronous per-field operations is not timed by this series; its in-process cost is measured in microseconds.
aisix_guardrail_blocks_total . Description: Requests rejected by input or output guardrail enforcement across all endpoints, including fail-closed paths such as a streamed-output buffer overflow before a guardrail member executes. . Type: counter . Label count: no labels
Labels
None.
aisix_guardrail_bypasses_total . Description: Guardrail evaluation failures or proxy-raised unreadable-content passes where a fail-open policy let the request or response continue, across all guarded endpoints. . Type: counter . Label count: 1 label
Labels
reasonValues for reason
aliyun_5xx, aliyun_config_error, aliyun_bad_response, aliyun_throttled, aliyun_timeout, azure_cs_5xx, azure_cs_config_error, azure_cs_throttled, azure_cs_timeout, bedrock_5xx, bedrock_throttled, bedrock_timeout, bedrock_too_large, lakera_5xx, lakera_config_error, lakera_throttled, lakera_timeout, lakera_too_large, openai_moderation_5xx, openai_moderation_config_error, openai_moderation_throttled, openai_moderation_timeout, openai_moderation_too_large, presidio_5xx, presidio_config_error, presidio_throttled, presidio_timeout, presidio_too_large, custom_timeout, custom_script_error, custom_engine_error, custom_no_verdict, custom_bad_verdict, custom_unknown_action, semantic_embed_unresolved, semantic_embed_timeout, semantic_embed_upstream, unscannable_body, output_buffer_exceededunscannable_body and output_buffer_exceeded are raised by the proxy itself: content AISIX could not read, and a held-back stream released unscanned under on_buffer_exceeded: fail_open.
A2A Metrics
Measure Agent-to-Agent traffic by the agent that was reached and the operation that was invoked.
Agent and Operation Labels
agent is a registered A2A agent, and operation is the canonical operation a caller invoked. A2A 0.3 and 1.0 spell one operation two ways, so AISIX records the canonical form and a deployment fronting both versions still aggregates as one series. An unrecognized method becomes unknown.
Task ids, context ids, and JSON-RPC request ids are deliberately absent. They are what makes an individual call traceable, which is exactly what makes them unusable as label values; find them in usage events and traces instead.
aisix_a2a_requests_total does not agree with aisix_proxy_requests_total{endpoint="/a2a"}, by design. A call refused before its agent is resolved has no agent to file under and is counted only in the proxy family. A stream the caller abandons is a 499 in both. Read this family for agent health and the proxy family for route traffic.
For streaming A2A, aisix_proxy_request_duration_seconds records the complete stream. aisix_request_e2e_latency_seconds{endpoint="/a2a"} records the agent-call lifetime, including the complete stream, and its side="upstream" series the call to the agent. Agent card fetches are counted under their own endpoint="/a2a/{agent}/.well-known/agent-card.json".
aisix_a2a_requests_total . Description: A2A calls by the agent reached, the canonical operation invoked, and the status class. . Type: counter . Label count: 3 labels
Labels
agent, operation, statusBehavior
Counted at the same point the usage event is emitted, so a call that is accounted for is also metered.
PromQL example
sum by (agent, operation) (
rate(aisix_a2a_requests_total{status!="2xx"}[5m])
)aisix_a2a_ttfb_seconds . Description: Time to the upstream agent's first streamed event on a streaming A2A call. . Type: histogram . Label count: 2 labels
Labels
agent, operationBehavior
Named for the event rather than a token because an agent stream carries task updates, not tokens. Default buckets match aisix_request_ttft_seconds, and are configurable with observability.metrics.buckets.a2a_ttfb.
Observed only on streaming operations that produced at least one event.
PromQL example
histogram_quantile(
0.90,
sum by (le, agent) (rate(aisix_a2a_ttfb_seconds_bucket[5m]))
)aisix_a2a_stream_events_total . Description: Events relayed downstream on streaming A2A calls. . Type: counter . Label count: 2 labels
Labels
agent, operationBehavior
Divided by aisix_a2a_requests_total over the streaming operations, it gives events per call — how chatty an agent is, and whether that changed. Both message/stream and tasks/resubscribe stream, so filter the denominator to both or the ratio is inflated.
PromQL example
sum by (agent) (rate(aisix_a2a_stream_events_total[5m]))
/
sum by (agent) (
rate(aisix_a2a_requests_total{operation=~"message/stream|tasks/resubscribe"}[5m])
)aisix_a2a_task_state_total . Description: A2A calls by the task state the agent last reported, normalized to the specification's set plus unknown. . Type: counter . Label count: 2 labels
Labels
agent, stateBehavior
A cumulative counter of the state each call ENDED on, so read it as a rate rather than as a live backlog: a task that later moves on does not decrement an earlier sample, and a client polling one task with tasks/get reports its state on every poll. A call whose upstream never answered reports no state and is not counted here.
PromQL example
sum by (agent, state) (rate(aisix_a2a_task_state_total[5m]))Usage Event Metrics
Distinguish usage-event emission attempts from events that never reached the control plane — either because the delivery queue did not accept them, or because the worker could not deliver them.
Usage Event Delivery
For each emission attempt, the event is either delivered to the control plane or counted as a drop. Subtract the drop rate from the emission-attempt rate to calculate the delivered rate. A delivered event can still be rejected by the control plane and never stored; aisix_usage_events_rejected_total counts those.
Drops come from two places. The queue-side reasons (sink_disabled, sink_full, sink_closed) count events the handoff queue never accepted, and carry the same model, provider_key_id, and provider_key_name labels as the emission counter, so the subtraction also holds per model and per provider key there. The delivery-side reasons (send_failed, retry_budget_exhausted) count events the worker accepted and then could not ship to the control plane; the worker holds events rather than the emitting handler's label set, so those samples report unknown for model and for both provider-key labels and carry only the member pair. emitted = delivered + dropped therefore holds in total and per user_id/user_name, while the per-model and per-provider-key subtraction covers the queue side only.
Queue acceptance is not delivery. After the worker accepts an event, control-plane shipping can still fail: the worker re-sends a failed batch while the control plane signals that it de-duplicates by batch id, and gives up after 30 minutes measured from the batch's oldest event or after eight answered failures, logging telemetry batch failed (events dropped). Those losses land on aisix_usage_event_drops_total under the delivery-side reasons. The exporter pipelines are a separate leg — fed from the same emission site rather than from the worker — and they can drop after retries too; exporter losses do not increment this counter and are counted by aisix_otlp_fanout_drops_total instead.
The status_code label is one of 2xx, 3xx, 4xx, 5xx, or other, while status carries the raw HTTP code alongside it — status names one failure mode, status_code rolls a family up, and both describe the same event. Example handler values include chat, embeddings, messages, and mcp.
user_id identifies the member associated with the API key the request authenticated with and is unknown when the key carries no member ID. user_name comes from that member's name document when one is present; an empty name there reports unknown. Only when the document is absent does it fall back to the API key's own user_name, and separate API keys can associate the same user_id with different fallback names. The pair appears on both counters, so emitted = delivered + dropped still holds for each pair. Because a JWT-authenticated request runs as the key its identity resolves to, it carries that key's member attribution.
model is the model the caller addressed, collapsed to a configured model name. A request that carried no resolvable model reports unresolved, and one with no model at all — an MCP tool call, an A2A agent call, a passthrough request whose body names no model — reports unknown, as do both provider-key labels wherever no upstream key was resolved.
MCP tool calls use handler="mcp" and inbound_protocol="mcp". Their usage-event payloads identify the MCP server and tool; token and cost fields are zero.
A2A agent calls use handler="a2a". The metric maps their bounded inbound_protocol label to other, while the delivered event uses inbound_protocol="a2a" and identifies the agent name and JSON-RPC method. The gateway estimates prompt and completion tokens from message text and sets usage_estimated: true; cost remains zero.
aisix_usage_events_emitted_total . Description: Usage-event emission attempts, counted before AISIX tries to enqueue the event, including events the queue accepted and events it rejected. status is the status the usage event records: a stream that fails after its 200 headers counts under the failure's status, such as 502, 504, or 499. From 1.11.0, it also counts an event for each model call the gateway makes itself while serving a request, such as a semantic router's embedding, so it rises on deployments that use semantic routing, the semantic cache, or semantic guardrails. . Type: counter . Label count: 10 labels
Labels
handler, status_code, status, inbound_protocol, upstream_protocol, model, provider_key_id, provider_key_name, user_id, user_nameValues for handler
a2a, audio, batch, batches, chat, completions, count_tokens, embeddings, files, fine_tuning, images, mcp, messages, passthrough_route, realtime, rerank, responses, videosValues for status_code
2xx, 3xx, 4xx, 5xx, otherValues for inbound_protocol
openai, anthropic, mcp, otherother includes A2A, realtime, passthrough, and every other value outside the three named protocol buckets.
aisix_usage_event_drops_total . Description: Usage events that never reached the control plane: the ones the handoff queue did not accept, and the ones the worker accepted but could not deliver. . Type: counter . Label count: 7 labels
Labels
reason, model, provider_key_id, provider_key_name, upstream_protocol, user_id, user_nameValues for reason
sink_disabled, sink_full, sink_closed, send_failed, retry_budget_exhaustedsink_disabled, sink_full, and sink_closed are queue-side: the event was never accepted. send_failed (the batch was given up on without being re-sent — the control plane did not signal de-duplication, answered that the batch is permanently unacceptable, or the gateway was shutting down) and retry_budget_exhausted (the batch aged past 30 minutes from its oldest event, or was answered and refused eight times in a row) are delivery-side, counted once per event the given-up batch carried. Delivery-side samples carry only user_id and user_name; model and both provider-key labels report unknown.
PromQL example
sum(rate(aisix_usage_event_drops_total[5m])) by (model, provider_key_name, reason)aisix_usage_events_rejected_total . Description: Usage events the control plane rejected inside a telemetry batch it otherwise accepted, incremented by the rejected count in its answer. These events are dropped, not re-sent, because the control plane would refuse them again, and they are not counted by aisix_usage_event_drops_total. Each such batch also logs control plane rejected usage events in an accepted telemetry batch (events dropped) with batch_id, count, and rejected. Emitted only in managed mode, where the gateway reports usage to a control plane. . Type: counter . Label count: no labels
Labels
None.
Behavior
The counter has no labels because the control plane answers with a count only, so there is no event to attribute a rejection to. Correlate by batch_id in the gateway log.
PromQL example
sum(increase(aisix_usage_events_rejected_total[1h]))aisix_usage_delivery_unhealthy_seconds . Description: How long usage events have been waiting with no telemetry delivery reaching the control plane, in seconds. 0 while delivery is healthy. . Type: gauge . Label count: no labels
Labels
None.
Behavior
During normal operation it reads up to one flush interval of about 5 seconds, because events wait for the next batch. A delivery counts as reaching the control plane when the control plane accepts the batch or rejects its content; a connection failure, a timeout, a server error, or an authentication refusal does not reset the gauge.
Under strict budget enforcement, the gateway starts rejecting budgeted traffic with 503 budget_unverified once this value reaches the organization's grace period. See Budgets in the Traffic Controls section.
Stays at 0 on a gateway that does not report usage to a control plane.
PromQL example
max(aisix_usage_delivery_unhealthy_seconds) > 300aisix_otlp_fanout_drops_total . Description: Telemetry records the exporter fan-out lost, by exporter and reason. Despite the metric name it covers every observability exporter — OTLP/HTTP, Alibaba Cloud SLS, object storage, and Datadog — because they all run on the same fan-out pipeline. Counted in records rather than batches, so it is comparable with what the exporter did deliver: one failed batch loses as many records as it carried. Not emitted by 1.1.0 or earlier releases. . Type: counter . Label count: 2 labels
Labels
exporter, reasonValues for reason
queue_full, worker_stopped, retries_exhausted, permanent_errorqueue_full and worker_stopped are refused at enqueue and lose one record at a time. retries_exhausted and permanent_error happen after an export attempt and lose the whole batch.
Behavior
exporter is the configured name of the observability exporter — the control-plane resource, or the resource-file row on a standalone gateway.
The fan-out and the usage-event queue are independent delivery legs fed from the same emission site, not one behind the other. Neither counter implies anything about the other: one record can be lost by both, by one, or by neither. Fan-out losses never increment aisix_usage_event_drops_total.
aisix_otlp_fanout_failures_total . Description: Failed export attempts against an observability exporter, counted once per attempt, retries included. Like the drop counter it covers every exporter kind, not only OTLP/HTTP. An exporter that only ever succeeds on its third try is visible here even though it never drops a record — that is the distinction from aisix_otlp_fanout_drops_total. Not emitted by 1.1.0 or earlier releases. . Type: counter . Label count: 1 label
Labels
exporterBehavior
exporter is the configured name of the observability exporter — the control-plane resource, or the resource-file row on a standalone gateway.
Configuration Metrics
Monitor whether AISIX can load and apply changes from its configuration source.
Configuration State
AISIX reflects the same live configuration state in these metrics and at GET /status/config on the metrics and status listener.
Reload metrics apply to both file and etcd configuration sources. Revision and source-connection metrics are emitted only when AISIX loads configuration from etcd.
Compare the observed and applied revisions to determine whether the gateway is serving the latest etcd configuration.
aisix_config_last_reload_successful . Description: Whether the latest configuration load succeeded. . Type: gauge . Label count: no labels
Labels
None.
Values for metric value
0, 11 indicates success and 0 indicates failure.
aisix_config_last_reload_success_timestamp_seconds . Description: Unix timestamp in seconds of the last successful configuration load. . Type: gauge . Label count: no labels
Labels
None.
Behavior
The series is not emitted until a configuration load succeeds.
aisix_config_reloads_total . Description: Full configuration reload attempts, including source fetch failures. . Type: counter . Label count: no labels
Labels
None.
Behavior
Incremental etcd watch events do not increment this counter.
aisix_config_reload_failures_total . Description: Configuration reload failures grouped by reason. . Type: counter . Label count: 1 label
Labels
reasonValues for reason
fetch, parse, validatefetch indicates that the source could not be read, parse indicates invalid source data, and validate indicates an invalid resource.
aisix_config_rejected_resources . Description: Current number of rejected resources, grouped by resource kind. . Type: gauge . Label count: 1 label
Labels
kindBehavior
When all rejections for a resource kind clear, AISIX sets its existing series to 0.
aisix_config_partially_compatible_resources . Description: Served resources carrying at least one field this gateway version does not recognize, grouped by resource kind. . Type: gauge . Label count: 1 label
Labels
kindBehavior
A resource with several ignored fields counts once. Inspect partially_compatible at GET /status/config for the field paths and per-field counts.
When all partially compatible resources for a kind clear, AISIX sets its existing series to 0.
aisix_config_stale_served_resources . Description: Resources whose latest source value was rejected while their last known good value remains in service, grouped by resource kind. . Type: gauge . Label count: 1 label
Labels
kindBehavior
Inspect rejected at GET /status/config to identify each resource and when stale serving began.
When no stale value remains in service for a kind, AISIX sets its existing series to 0.
aisix_config_unknown_kind_resources . Description: Retained etcd keys classified as unknown_kind, grouped by resource kind. They are reported in unknown_kinds at GET /status/config, are not counted by aisix_config_rejected_resources, and do not set aisix_config_last_reload_successful to 0. . Type: gauge . Label count: 1 label
Labels
kindBehavior
This usually means the control plane projects a resource kind released after the gateway. It can also mean a known kind was written under the shared pricing-catalog prefix, which accepts only pricing; inspect unknown_kinds[].last_error to distinguish the cases.
The gateway retains at most 256 unknown-kind keys across all kinds, separately from real rejections. Values are lower bounds while more than 256 keys are affected; after an overflow, they can remain incomplete until a full configuration resynchronization rebuilds the retained set.
When no retained unknown keys of a kind remain, AISIX sets its existing series to 0.
aisix_config_observed_revision . Description: Latest etcd revision observed by the gateway. . Type: gauge . Label count: no labels
Labels
None.
aisix_config_applied_revision . Description: The etcd revision represented by the configuration currently served by the gateway. . Type: gauge . Label count: no labels
Labels
None.
aisix_config_hash_info . Description: Applied configuration hash. . Type: gauge . Label count: 1 label
Labels
hashValues for metric value
0, 1Filter for value 1 to select the current hash. AISIX retains earlier hash labels with value 0 after the applied configuration changes.
aisix_config_source_connected . Description: Whether the gateway is connected to its etcd configuration source. . Type: gauge . Label count: no labels
Labels
None.
Values for metric value
0, 11 indicates connected and 0 indicates disconnected.
aisix_config_apply_duration_seconds . Description: Wall time of one configuration apply: parsing the source values, building the new snapshot, hashing it, and publishing it to the request path. Emitted only when AISIX loads configuration from etcd. . Type: summary . Label count: 1 label
Labels
triggerValues for trigger
watch, fullwatch is one coalesced batch of etcd watch events. full is a read of every watched prefix: the load that opens a watch cycle, and a resynchronization after the watch was interrupted or the revision compacted away.
Behavior
Exposed as a summary rather than a histogram. It carries per-instance quantiles over a rolling window and no _bucket series, so histogram_quantile() returns nothing for it and its quantiles cannot be aggregated across gateway instances.
The first apply at startup may be missing: the metrics registry is built while it runs. Every later apply is recorded.
aisix_config_apply_batch_events . Description: How much change one configuration apply carried: watch events for trigger="watch", and keys read for trigger="full". Emitted only when AISIX loads configuration from etcd. . Type: summary . Label count: 1 label
Labels
triggerValues for trigger
watch, fullwatch is one coalesced batch of etcd watch events. full is a read of every watched prefix: the load that opens a watch cycle, and a resynchronization after the watch was interrupted or the revision compacted away.
Behavior
Read beside aisix_config_apply_duration_seconds to separate "the control plane wrote a lot" from "one small write costs this much".
Exposed as a summary, with the same aggregation limits as the duration metric.
Memory Metrics
Find out which part of the gateway process holds its memory: the allocator, the async runtimes, and each in-process store.
Reading Memory Metrics
These series are read when Prometheus scrapes the endpoint, never on the request path, and every label has a fixed set of values.
Start with aisix_component_bytes and aisix_component_entries to find the store that grows, then take a heap profile when no store accounts for the growth. See Memory Diagnostics in the Observability section for the troubleshooting workflow.
aisix_allocator_bytes . Description: The memory allocator's own byte counts. Published only by the Linux build in the published AISIX image. . Type: gauge . Label count: 1 label
Labels
statValues for stat
allocated, active, resident, mapped, retained, metadataallocated is live objects, active the pages backing them, resident allocator pages in physical memory, mapped pages mapped by the allocator, retained pages returned to the operating system but kept reserved, and metadata the allocator's own bookkeeping.
Behavior
allocated climbing means the gateway holds more objects. resident far above allocated means fragmentation or freed pages not yet returned to the operating system.
aisix_memory_limit_bytes . Description: The memory limit the process runs under, read from cgroup v2 memory.max or cgroup v1 memory.limit_in_bytes. The series is absent when the process has no limit. . Type: gauge . Label count: no labels
Labels
None.
PromQL example
process_resident_memory_bytes / aisix_memory_limit_bytesaisix_component_entries . Description: Entries held by one in-process store. . Type: gauge . Label count: 2 labels
Labels
component, exporterValues for component
usage_event_queue, exporter_queue, log_queue, response_cache, semantic_cache, route_embedding_cache, ratelimit_local_keys, snapshot_pending_reclaim, metric_series, upstream_clients, in_flight_request_bodiesresponse_cache and semantic_cache count entries held in this process, not in Redis. ratelimit_local_keys counts keys with the in-memory rate-limit backend and is 0 with Redis. snapshot_pending_reclaim counts retired configuration snapshots that in-flight requests still hold. metric_series counts the series the gateway publishes. upstream_clients counts HTTP clients built for Provider Keys with their own connection settings. in_flight_request_bodies counts in-flight proxy requests that have read body bytes.
Values for exporter
exporter name, emptySet to the exporter name only for component="exporter_queue", and empty for every other component. A deleted exporter's series drops to 0.
aisix_component_bytes . Description: Bytes held by one in-process store, reported only where the store accounts them exactly. . Type: gauge . Label count: 1 label
Labels
componentValues for component
log_queue, guardrail_holdback, in_flight_request_bodiesguardrail_holdback counts streamed responses held back for an output guardrail on chat completions, messages, responses (including bridged responses), and passthrough routes. It does not count a response read whole before it is relayed, such as a non-streaming response or the buffered audio relay. in_flight_request_bodies counts the request body bytes that in-flight proxy requests have read, on every proxy route.
Behavior
While a request waits on its upstream, the gateway holds about twice its request body, so in_flight_request_bodies rising together with aisix_proxy_in_flight_requests means large requests are waiting on slow upstreams.
PromQL example
aisix_component_bytes{component="in_flight_request_bodies"}aisix_runtime_alive_tasks . Description: Tasks alive on one async runtime. Growth while traffic stays flat means tasks are leaking. . Type: gauge . Label count: 1 label
Labels
runtimeValues for runtime
control, tpc-0 … tpc-Ncontrol is the runtime that carries the listeners and background work. tpc-0 through tpc-N are the thread-per-core proxy workers, present only when proxy.thread_per_core is on.
aisix_runtime_global_queue_depth . Description: Tasks queued on one async runtime's shared queue and not yet picked up by a worker. Uses the same runtime values as aisix_runtime_alive_tasks. . Type: gauge . Label count: 1 label
Labels
runtimeaisix_heap_profile_dumps_total . Description: Heap profiles taken. Published only by the Linux build in the published AISIX image, and only while heap sampling is active. . Type: counter . Label count: 2 labels
Labels
trigger, resultValues for trigger
auto, manualauto is a profile written as resident memory crossed a threshold. manual is a request to GET /debug/pprof/heap.
Values for result
ok, errorPromQL example
increase(aisix_heap_profile_dumps_total{trigger="auto",result="ok"}[1h]) > 0Gateway Process Metrics
Monitor the gateway process itself, independently of the traffic passing through it.
aisix_log_lines_dropped_total . Description: Log events the gateway discarded because its log sink was not draining fast enough. Covers the access log and the application log together, since both are written through the same queue. . Type: counter . Label count: no labels
Labels
None.
Behavior
Published on every scrape, so a healthy gateway reports 0 rather than omitting the series. That makes "no drops" distinguishable from "this gateway is too old to report drops".
Any increase means the log is incomplete for that window: the gateway kept serving requests and dropped the lines instead. Investigate whatever collects the standard error stream of the gateway.
PromQL example
increase(aisix_log_lines_dropped_total[5m]) > 0process_resident_memory_bytes . Description: Resident memory of the gateway process, in bytes. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
process_virtual_memory_bytes . Description: Virtual memory size of the gateway process, in bytes. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
process_threads . Description: Threads in the gateway process. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
process_open_fds . Description: Open file descriptors, including network connections. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
process_max_fds . Description: The open file descriptor limit of the process. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
process_cpu_seconds_total . Description: User and system CPU time the process has used, in seconds. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: counter . Label count: no labels
Labels
None.
process_start_time_seconds . Description: When the process started, in seconds since the Unix epoch. Published on Linux under the standard Prometheus process-collector name, so existing process dashboards and alerts work unchanged. . Type: gauge . Label count: no labels
Labels
None.
Analyze Metrics with PromQL
Use these PromQL examples in the Prometheus expression browser or another compatible monitoring interface after configuring it to scrape the AISIX metrics endpoint. Adjust the time window, label filters, and grouping dimensions to match the traffic and gateway instances you want to inspect.
Calculate Success Rate
Calculate the success rate by dividing the successful request rate by the total request rate. The following query combines all model-inference traffic over a five-minute window:
sum(rate(aisix_llm_requests_total{outcome="success"}[5m]))
/
sum(rate(aisix_llm_requests_total[5m]))
Add an endpoint filter or group by endpoint when you want to analyze one API separately.
To include traffic that is not counted as model inference — MCP tool calls, A2A agent calls, passthrough routes (endpoint label /passthrough_route), and the file, batch, and fine-tuning routes — run the same query against aisix_proxy_requests_total, which carries every proxied request.
To measure only the primary routing path, restrict the numerator and denominator to requests that were not served by a fallback target:
sum(rate(aisix_llm_requests_total{outcome="success", is_fallback="false"}[5m]))
/
sum(rate(aisix_llm_requests_total{is_fallback="false"}[5m]))
Whether rate-limited requests belong in the population is an operational policy decision. outcome="rate_limited" is every HTTP 429: a gateway rate limit, a budget refusal, and an upstream's own 429. To exclude all of them from the denominator, use:
sum(rate(aisix_llm_requests_total{outcome="success"}[5m]))
/
sum(rate(aisix_llm_requests_total{outcome!="rate_limited"}[5m]))