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.

Grafana

Page as Markdown

Visualize agentgateway metrics in Grafana by using the pre-built Kubernetes dashboard or custom PromQL panels for binary and Docker deployments.

Verified Code examples on this page have been automatically tested and verified.

Grafana is an open-source visualization platform that turns time-series data into dashboards, graphs, and alerts. It is the standard way to visualize agentgateway metrics that are collected by Prometheus, and supports correlating metrics with traces by adding Jaeger as a second data source in the same Grafana instance.

Agentgateway ships a pre-built dashboard for Kubernetes deployments that covers requests, LLM traffic, MCP traffic, and connections out of the box.

For binary and Docker deployments where the pre-built dashboard does not apply, you can use the PromQL queries that are included in this guide to help you get started with building your own Grafana panels.

Before you begin

Set up a Prometheus instance so that you can start collecting metrics and feeding them into Grafana. Do not run that guide’s cleanup step until you finish this one, because both guides use the monitoring namespace.

Note

The kube-prometheus-stack chart already installs Grafana as the kube-prometheus-stack-grafana service. If you set up Prometheus with that chart, skip steps 1 through 3 and port-forward svc/kube-prometheus-stack-grafana instead. Get its admin password with kubectl get secret -n monitoring kube-prometheus-stack-grafana -o jsonpath="{.data.admin-password}" | base64 --decode.

Use the pre-built Grafana dashboard (Kubernetes only)

The pre-built dashboard includes the following sections:

SectionMetricDescription
OverviewMemoryThe working set memory that each agentgateway proxy pod consumes.
OverviewCPUThe CPU usage rate for each agentgateway proxy pod.
RequestsRequests (by Pod)The request rate that each agentgateway proxy pod handles.
RequestsRequests (by Gateway)The request rate for each gateway.
RequestsRequests (by Status)The request rate grouped by HTTP response status.
RequestsRequests (by Reason)The request rate grouped by the response reason.
LLMToken ConsumptionThe rate of tokens that LLM requests consume, grouped by token type, model, and gateway.
LLMTime To First TokenThe time that it takes the LLM provider to return the first token of a response.
LLMRequest TimeThe total duration of LLM requests.
LLMTokens Per SecondThe rate at which the LLM provider returns output tokens.
MCPMCP Calls (by method)The rate of MCP requests grouped by JSON-RPC method.
MCPTool Calls (by tool)The rate of MCP tool calls grouped by server, resource, and tool.
LatencyLatency by RouteThe 50th, 95th, and 99th percentile request latency for each gateway and route.
XDSXDS Messages by TypeThe rate of xDS configuration messages that the control plane sends, grouped by resource type.
XDSXDS Average Message SizeThe average size of xDS messages, grouped by resource type.
RuntimeCgroup MemoryThe cgroup memory usage for each agentgateway proxy pod, such as working set, anonymous, file, and kernel memory.
RuntimeProcess MemoryThe process-level memory for each agentgateway proxy pod, such as RSS, PSS, private, shared, and swap memory.
RuntimeTokio RuntimeThe async runtime statistics for each agentgateway proxy pod, such as the worker count, number of alive tasks, and global queue depth.
RuntimeBuild VersionsThe agentgateway build versions that are running, grouped by tag.
  1. Add the Grafana Helm repository and install Grafana.

    helm repo add grafana https://grafana.github.io/helm-charts
    helm install grafana grafana/grafana -n monitoring --create-namespace
  2. Verify that the Grafana pod is running.

    kubectl get pods -n monitoring
  3. Get the Grafana admin password.

    kubectl get secret -n monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode
  4. Forward the Grafana port to access the UI.

    kubectl port-forward -n monitoring svc/grafana 3001:80
  5. Access Grafana at http://localhost:3001. Log in with the admin username and the password that you created in the previous step.

  6. Add a Prometheus data source.

    1. Go to ConnectionsAdd new connection.
    2. Search for and select the Prometheus plugin, then click Add new data source.
    3. Set the URL to your in-cluster Prometheus service, such as http://kube-prometheus-stack-prometheus.monitoring.svc.cluster.local:9090.
    4. Click Save & Test.
  7. Download the agentgateway dashboard JSON.

    curl -L "https://raw.githubusercontent.com/agentgateway/agentgateway/main/controller/install/helm/agentgateway/files/agentgateway-dashboard.json" \
      -o agentgateway-dashboard.json
  8. In Grafana, go to DashboardsNewImport.

  9. Click Upload dashboard JSON file and select the agentgateway-dashboard.json file.

  10. Select your Prometheus data source and click Import.

  11. When you are done, remove Grafana and the monitoring namespace.

    helm uninstall grafana -n monitoring
    kubectl delete namespace monitoring

Build your own Grafana panels (Binary and Docker)

  1. Run Grafana with Docker.

    docker run -d --name grafana \
      -p 3001:3000 \
      grafana/grafana:latest
  2. Access the Grafana UI at http://localhost:3001. Use the admin username and admin password to log into Grafana.

  3. Add a Prometheus data source.

    1. Go to ConnectionsAdd new connection.
    2. Search for and select the Prometheus plugin, then click Add new data source.
    3. Set the Prometheus server URL to http://host.docker.internal:9090.
    4. Click Save & Test.
  4. Create a dashboard.

    1. Go to DashboardsNewNew dashboard.
    2. Add a Panel and click Configure visualization.
    3. Select your Prometheus data source.
    4. Switch to the Code view and enter a PromQL query in the query editor. For example, to see request rate by route:
      rate(agentgateway_requests_total[5m])
    5. Click Apply to save the panel, then save the dashboard.

    For more queries to build out your dashboard, see Common PromQL queries.

  5. When you are done, remove the Grafana container.

    docker rm -f grafana

Common PromQL queries

Use these queries to build custom panels or alerts. To enter a raw PromQL query in Grafana, switch the query editor from Builder to Code mode by using the toggle in the query section.

Use casePromQL query
Request raterate(agentgateway_requests_total[5m])
Error raterate(agentgateway_requests_total{status=~"5.."}[5m]) / rate(agentgateway_requests_total[5m])
LLM token usage (input)sum by (gen_ai_system, gen_ai_request_model) (rate(agentgateway_gen_ai_client_token_usage_sum{gen_ai_token_type="input"}[5m]))
Time to first token (p95)histogram_quantile(0.95, rate(agentgateway_gen_ai_server_time_to_first_token_bucket[5m]))
MCP tool call rate by toolsum by (server, resource) (rate(agentgateway_mcp_requests_total{method="tools/call"}[5m]))

Add a Jaeger data source for traces

To correlate metrics with traces in the same Grafana instance:

  1. Go to ConnectionsAdd new connection.
  2. Search for and select the Jaeger plugin, then click Add new data source.
  3. Set the URL to your Jaeger instance, such as http://jaeger:16686.
  4. Click Save & Test.
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/.