Pular para o conteúdo principal

Prometheus

Collect metrics from agentgateway with Prometheus

Agentgateway exposes Prometheus-compatible metrics for monitoring and alerting.

Metrics endpoint

Agentgateway exposes metrics on port 15020 by default:

curl http://localhost:15020/metrics

Available metrics

Request metrics

MetricTypeDescription
agentgateway_requests_totalCounterTotal number of requests
agentgateway_request_duration_secondsHistogramRequest duration
agentgateway_request_size_bytesHistogramRequest size
agentgateway_response_size_bytesHistogramResponse size

Connection metrics

MetricTypeDescription
agentgateway_connections_activeGaugeActive connections
agentgateway_connections_totalCounterTotal connections

MCP metrics

MetricTypeDescription
agentgateway_mcp_sessions_activeGaugeActive MCP sessions
agentgateway_mcp_requests_totalCounterTotal MCP requests by method

LLM metrics

MetricTypeDescription
agentgateway_llm_requests_totalCounterTotal LLM requests
agentgateway_llm_tokens_totalCounterTotal tokens (input/output)
agentgateway_llm_request_duration_secondsHistogramLLM request duration

Prometheus configuration

Add agentgateway to your Prometheus configuration:

# prometheus.yml
scrape_configs:
- job_name: 'agentgateway'
static_configs:
- targets: ['localhost:15020']
scrape_interval: 15s

Docker Compose example

version: '3'
services:
agentgateway:
image: cr.agentgateway.dev/agentgateway:latest
ports:
- "3000:3000"
- "15020:15020"
volumes:
- ./config.yaml:/config.yaml:ro
command: ["-f", "/config.yaml"]

prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'

Learn more