Prometheus
Every Prometheus metric AgentShield exports, their labels, scrape configuration, and example queries.
Each service exposes Prometheus text format at /metrics on a port separate from its API.
Endpoints
| Service | Variable | From source | In the image |
|---|---|---|---|
| Gateway | GATEWAY_METRICS_ADDR | 127.0.0.1:9081 | 0.0.0.0:9081 |
| Control plane | CONTROL_PLANE_METRICS_ADDR | 127.0.0.1:9080 | 0.0.0.0:9080 |
| Intelligence | INTELLIGENCE_METRICS_ADDR | 127.0.0.1:9082 | 0.0.0.0:9082 |
| Event relay | RELAY_HTTP_ADDR | 127.0.0.1:8083 | 0.0.0.0:8083 |
Set a variable to off to disable that listener. A service refuses to start if its metrics address equals its API address.
Unauthenticated by design
Metrics endpoints have no authentication. They contain platform totals only, but keep them on a network that only your monitoring system can reach.
Metrics
Gateway
| Metric | Type | Labels |
|---|---|---|
agentshield_gateway_http_requests_total | counter | route (authorize, execute, health_live, health_ready, other), code |
agentshield_gateway_http_request_duration_seconds | histogram | route |
agentshield_gateway_decisions_total | counter | outcome |
agentshield_gateway_executions_total | counter | tool (registered adapter or unregistered), result (completed, timeout, or a failure code) |
agentshield_gateway_adapter_duration_seconds | histogram | tool |
agentshield_gateway_analysis_total | counter | status |
agentshield_gateway_analysis_findings_total | counter | rule_id |
Event relay
| Metric | Type | Meaning |
|---|---|---|
agentshield_relay_events_published_total | counter | Events acknowledged by JetStream |
agentshield_relay_publish_failures_total | counter | Drains stopped by a publish failure |
agentshield_relay_outbox_backlog | gauge | Events waiting; -1 when unreadable |
agentshield_relay_outbox_oldest_seconds | gauge | Age of the oldest waiting event |
agentshield_relay_evidence_total | counter | result: written, duplicate, dropped, retry |
agentshield_relay_reliability_rows_total | counter | Reliability minute rows written |
Control plane
| Metric | Labels |
|---|---|
agentshield_control_plane_http_requests_total | method, route (Express pattern such as /api/v1/agents/:agentId, or unmatched), code |
agentshield_control_plane_http_request_duration_seconds | route |
agentshield_control_plane_nodejs_* | Node.js runtime metrics |
Intelligence engine
| Metric | Labels |
|---|---|
agentshield_intelligence_http_requests_total | route, code |
agentshield_intelligence_analyze_duration_seconds | — |
agentshield_intelligence_items_total | — |
agentshield_intelligence_verdicts_total | verdict |
agentshield_intelligence_findings_total | rule_id |
Go processes also export go_* and process_*. Counters with a fixed label set are initialized at zero, so rate() and increase() see the first event.
Label safety
No metric carries an organization, agent, user, resource, or request id. Label values come from fixed sets; anything else is other or unregistered. Crafted paths and tool names cannot create new series.
Scrape configuration
scrape_configs:
- job_name: gateway
static_configs: [{ targets: ["gateway:9081"] }]
- job_name: control-plane
static_configs: [{ targets: ["control-plane:9080"] }]
- job_name: intelligence
static_configs: [{ targets: ["intelligence:9082"] }]
- job_name: event-relay
static_configs: [{ targets: ["event-relay:8083"] }]
rule_files: ["/etc/prometheus/alerts.yml"]The repository's infrastructure/monitoring/prometheus.yml and alerts.yml are used by Compose. Validate rule changes with promtool:
docker run --rm --entrypoint promtool \
-v "$PWD/infrastructure/monitoring:/m:ro" prom/prometheus:v3.1.0 check rules /m/alerts.ymlExample queries
# Share of denied decisions over 15 minutes
sum(rate(agentshield_gateway_decisions_total{outcome="deny"}[15m]))
/ sum(rate(agentshield_gateway_decisions_total[15m]))
# p95 adapter latency per tool
histogram_quantile(0.95, sum by (le, tool) (rate(agentshield_gateway_adapter_duration_seconds_bucket[5m])))
# Calls refused by an open circuit
sum by (tool) (increase(agentshield_gateway_executions_total{result="circuit_open"}[1h]))
# Injection findings by rule
sum by (rule_id) (increase(agentshield_gateway_analysis_findings_total{rule_id=~"PI.*"}[1h]))Implementation references
Was this page helpful?