For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
View and customize metrics
View and monitor agentgateway metrics for traffic, LLM, MCP, and connection insights.
Agentgateway exposes a Prometheus-compatible metrics endpoint on port 15020. Metrics are collected automatically for every request that passes through the gateway.
View metrics
The metrics endpoint is available at port 15020 by default.
curl http://localhost:15020/metricsMetrics are grouped under the agentgateway_ prefix and follow the OpenMetrics format. For an overview of available metrics, see the metrics reference.
For instructions on setting up Prometheus to scrape agentgateway metrics, see Prometheus.
Add custom metric labels
You can enrich all metrics with custom labels that are computed from CEL expressions. Labels are added to every metric that carries the route identifier labels.
The following example adds two labels to all metrics:
env: '"production"': Adds a static label. The outer single quotes are YAML, the inner double quotes are the CEL string literal, so every metric getsenv="production"appended.user_id: 'request.headers["x-user-id"]': Adds a dynamic label. The CEL expression reads thex-user-idheader from the incoming request, souser_idin the metric reflects whoever made the request.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
config:
metrics:
fields:
add:
env: '"production"'
user_id: 'request.headers["x-user-id"]'Remove metrics
To reduce cardinality or storage, you can exclude specific metrics by name:
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
config:
metrics:
remove:
- agentgateway_upstream_call_duration_secondsMetric names can be supplied with or without the _total and unit suffixes. Agentgateway automatically matches all variants.