Metrics reference
Review the metrics that are available in agentgateway.
Note
All counter and histogram metrics only appear in the output after the first request of that type. For example, agentgateway_mcp_requests_total is not present until MCP traffic is received. This is normal Prometheus behavior. Counters and histograms are not pre-initialized.
Data plane metrics
The XDS metrics track communication with an XDS management server. Agentgateway registers them only in Kubernetes mode against a control plane, so they do not appear on the metrics endpoint of a standalone process.
The LLM metrics follow the OpenTelemetry semantic conventions for generative AI.
XDS
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_xds_connection_terminations_total | Counter | — | The total number of completed connections to xds server (unstable). |
agentgateway_xds_message_bytes_total | Counter | bytes | Total number of bytes received (unstable). |
agentgateway_xds_message_total | Counter | — | Total number of messages received (unstable). |
HTTP
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_request_duration_seconds | Histogram | seconds | Duration of HTTP requests (seconds). |
agentgateway_request_processing_seconds | Histogram | seconds | Duration from receiving an HTTP request to sending the primary outbound call (seconds). |
agentgateway_requests_active | Gauge | — | Number of HTTP requests to a backend currently awaiting a complete response. |
agentgateway_requests_shed_total | Counter | — | Total downstream requests rejected by the in-flight request limit. |
agentgateway_requests_total | Counter | — | The total number of HTTP requests sent. |
agentgateway_response_bytes_total | Counter | bytes | Total HTTP response bytes received. |
agentgateway_response_processing_seconds | Histogram | seconds | Duration from receiving the primary outbound response to sending the HTTP response (seconds). |
agentgateway_retries_total | Counter | — | The total number of request retries. |
TCP
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_downstream_connections_shed_total | Counter | — | Total downstream connections closed by the active connection limit. |
agentgateway_downstream_connections_total | Counter | — | The total number of downstream connections established. |
agentgateway_downstream_received_bytes_total | Counter | bytes | Total TCP bytes received per connection labels. |
agentgateway_downstream_sent_bytes_total | Counter | bytes | Total TCP bytes transmitted per connection labels. |
agentgateway_tls_handshake_duration_seconds | Histogram | seconds | Duration to complete inbound TLS/HTTPS handshake (seconds). |
agentgateway_upstream_connect_duration_seconds | Histogram | seconds | Duration to establish upstream connection (seconds). |
MCP
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_mcp_requests_total | Counter | — | Total number of MCP requests. |
LLM
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_cost_catalog_lookups_total | Counter | — | Total number of model cost catalog lookups by resolution status. |
agentgateway_gen_ai_client_cost_usd_total | Counter | usd | Cumulative USD cost of generative AI requests. |
agentgateway_gen_ai_client_token_usage | Histogram | — | Number of tokens used per request. |
agentgateway_gen_ai_server_inter_chunk_latency | Histogram | — | Time between consecutive output chunks for a given request. |
agentgateway_gen_ai_server_request_duration | Histogram | — | Duration of a generative AI request in seconds; failed operations have error_type="_OTHER" and successful operations omit the label. |
agentgateway_gen_ai_server_time_per_output_token | Histogram | — | Time to generate each output token for a given request. |
agentgateway_gen_ai_server_time_to_first_token | Histogram | — | Time to generate the first token for a given request. |
agentgateway_guardrail_checks_total | Counter | — | Total number of guardrail checks. |
Misc
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_atenet_router_route_duration_seconds | Histogram | seconds | Time from receiving a Substrate request to resolving its worker endpoint. |
agentgateway_build_info | Info | — | Agentgateway build information. |
agentgateway_config_synchronized | Gauge | — | Whether the last configuration load/reload was successful or not, being synchronized with the on-disk configuration. |
agentgateway_substrate_request_parking_active | Gauge | — | Number of requests waiting for a Substrate actor to become routable. |
agentgateway_upstream_call_duration_seconds | Histogram | seconds | Duration of outbound calls made by agentgateway (seconds). |
agentgateway_upstream_connections_active | Gauge | — | Number of currently open upstream connections. |
MCP request outcomes
The outcome label of the agentgateway_mcp_requests_total metric has one of the following values. Agentgateway checks the conditions in order and uses the first value that matches. For example, a response with a 5xx HTTP status that also carries a JSON-RPC error is counted as gateway_error, not protocol_error.
gateway_error: Agentgateway returned an error for the request, or the response has a 4xx or 5xx HTTP status.protocol_error: The response is a JSON-RPC error.tool_error: The request is atools/callrequest, and the tool result setsisError: true.success: The request is atools/callrequest with a tool result that does not setisError: true, or the request uses any other method and the response has a 2xx HTTP status.unknown: The request does not match any of the previous conditions. For example, atools/callrequest that has no tool result is counted asunknown, even if the response has a 2xx HTTP status.
Runtime and process metrics
Async runtime
These metrics reflect the async runtime of the agentgateway process. They appear on every startup, regardless of traffic.
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_tokio_num_workers | Gauge | — | The number of worker threads the async runtime uses. |
agentgateway_tokio_num_alive_tasks | Gauge | — | The number of tasks currently alive in the async runtime. |
agentgateway_tokio_global_queue_depth | Gauge | — | The number of tasks currently scheduled in the async runtime’s global queue. |
Cgroup memory
These metrics track Linux cgroup v2 memory statistics for the agentgateway process. They are available whenever agentgateway runs in a Linux environment, including standalone deployments, and are not specific to Kubernetes mode.
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_cgroup_usage | Gauge | bytes | Current memory usage. |
agentgateway_cgroup_working_set | Gauge | bytes | Current working set. |
agentgateway_cgroup_anon | Gauge | bytes | Current anonymous memory usage. |
agentgateway_cgroup_active_anon | Gauge | bytes | Current active anonymous memory usage. |
agentgateway_cgroup_inactive_anon | Gauge | bytes | Current inactive anonymous memory usage. |
agentgateway_cgroup_file | Gauge | bytes | Current file memory usage. |
agentgateway_cgroup_file_mapped | Gauge | bytes | Current mapped file memory usage. |
agentgateway_cgroup_active_file | Gauge | bytes | Current active file memory usage. |
agentgateway_cgroup_inactive_file | Gauge | bytes | Current inactive file memory usage. |
agentgateway_cgroup_shmem | Gauge | bytes | Current shared memory usage. |
agentgateway_cgroup_kernel | Gauge | bytes | Current kernel memory usage. |
agentgateway_cgroup_kernel_stack | Gauge | bytes | Current kernel stack memory usage. |
agentgateway_cgroup_pagetables | Gauge | bytes | Current page tables memory usage. |
agentgateway_cgroup_percpu | Gauge | bytes | Current per-CPU memory usage. |
agentgateway_cgroup_sock | Gauge | bytes | Current socket memory usage. |
agentgateway_cgroup_slab | Gauge | bytes | Current slab memory usage. |
agentgateway_cgroup_slab_reclaimable | Gauge | bytes | Current reclaimable slab memory usage. |
agentgateway_cgroup_slab_unreclaimable | Gauge | bytes | Current unreclaimable slab memory usage. |
agentgateway_cgroup_pgfault_total | Counter | — | Total cgroup page faults. |
agentgateway_cgroup_pgmajfault_total | Counter | — | Total cgroup major page faults. |
agentgateway_cgroup_workingset_refault_anon_total | Counter | — | Total anonymous working set refaults. |
agentgateway_cgroup_workingset_refault_file_total | Counter | — | Total file working set refaults. |
agentgateway_cgroup_workingset_activate_anon_total | Counter | — | Total anonymous working set activations. |
agentgateway_cgroup_workingset_activate_file_total | Counter | — | Total file working set activations. |
agentgateway_cgroup_workingset_restore_anon_total | Counter | — | Total anonymous working set restores. |
agentgateway_cgroup_workingset_restore_file_total | Counter | — | Total file working set restores. |
Process memory
These metrics track process-level memory for the agentgateway process, sourced from /proc/self/smaps. They are available whenever agentgateway runs in a Linux environment, including standalone deployments, and are not specific to Kubernetes mode.
| Metric | Type | Unit | Description |
|---|---|---|---|
agentgateway_process_size | Gauge | bytes | Total virtual memory size of the process. |
agentgateway_process_rss | Gauge | bytes | RSS (resident set size) memory usage. |
agentgateway_process_pss | Gauge | bytes | PSS (proportional set size) memory usage. |
agentgateway_process_pss_dirty | Gauge | bytes | Dirty PSS memory usage. |
agentgateway_process_shared_clean | Gauge | bytes | Shared clean memory usage. |
agentgateway_process_shared_dirty | Gauge | bytes | Shared dirty memory usage. |
agentgateway_process_private_clean | Gauge | bytes | Private clean memory usage. |
agentgateway_process_private_dirty | Gauge | bytes | Private dirty memory usage. |
agentgateway_process_referenced | Gauge | bytes | Referenced memory usage. |
agentgateway_process_anonymous | Gauge | bytes | Anonymous memory usage. |
agentgateway_process_lazy_free | Gauge | bytes | Lazy free memory. |
agentgateway_process_anon_huge_pages | Gauge | bytes | Anonymous huge pages usage. |
agentgateway_process_shmem_huge_pages | Gauge | bytes | Shared memory huge pages usage. |
agentgateway_process_shmem_pmd_mapped | Gauge | bytes | Shared memory PMD-mapped usage. |
agentgateway_process_file_pmd_mapped | Gauge | bytes | File PMD-mapped usage. |
agentgateway_process_shared_hugetlb | Gauge | bytes | Shared hugetlb usage. |
agentgateway_process_private_hugetlb | Gauge | bytes | Private hugetlb usage. |
agentgateway_process_swap | Gauge | bytes | Process swap usage. |
agentgateway_process_swap_pss | Gauge | bytes | Process proportional swap usage. |
agentgateway_process_locked | Gauge | bytes | Process locked memory usage. |