Skip to content
agentgateway has joined the Agentic AI FoundationLearn more

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

Page as Markdown

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/metrics

Metrics 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 gets env="production" appended.
  • user_id: 'request.headers["x-user-id"]': Adds a dynamic label. The CEL expression reads the x-user-id header from the incoming request, so user_id in 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_seconds

Metric names can be supplied with or without the _total and unit suffixes. Agentgateway automatically matches all variants.

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.