Skip to Content
AgentShield
Architecture

Observability Architecture

Prometheus metrics on dedicated ports, tenant-safe labels, structured logs, the Grafana dashboard, alert rules, and benchmarks.

AgentShield is multi-tenant, and a metrics endpoint is usually scraped by infrastructure that tenants do not control. Its observability design starts from that constraint: platform totals are public to the monitoring system; per-tenant detail stays behind control plane roles.

Signals

SignalWhereContains
Prometheus metricsEach service, on a dedicated portRates, latencies, outcomes, with fixed-set labels only
Structured logsProcess stdout (JSON in Go)One line per request: trace id, span id, route, duration. Never bodies or content
Security eventsPostgreSQL, then NATSPer-organization, redacted, hash-chained. See Event processing
Reliability metricsreliability_metrics tablePer-organization, per-tool minute rows, read through the control plane
Health/health/live, /health/readyLiveness and dependency readiness

Metrics ports

ServiceVariableFrom sourceIn the image
GatewayGATEWAY_METRICS_ADDR127.0.0.1:90810.0.0.0:9081
Control planeCONTROL_PLANE_METRICS_ADDR127.0.0.1:90800.0.0.0:9080
IntelligenceINTELLIGENCE_METRICS_ADDR127.0.0.1:90820.0.0.0:9082
Event relayRELAY_HTTP_ADDR (with health)127.0.0.1:80830.0.0.0:8083

A metrics address must differ from the service's API address, and each service refuses to start otherwise. Metrics are therefore never reachable through the API's ingress by accident. off disables a listener. Compose does not publish metrics ports; Kubernetes network policies admit only pods labelled agentshield.io/metrics-scraper: "true".

Label policy

No metric carries an organization, agent, user, resource, or request id. Every label value comes from a fixed set: route names, outcomes, registered tool names, and known rule ids. Anything else is recorded as other or unregistered. This bounds cardinality, so a caller cannot create series with crafted paths, and a scrape reveals nothing about any one tenant.

Key metrics

MetricLabelsMeaning
agentshield_gateway_http_requests_totalroute, codeGateway requests
agentshield_gateway_decisions_totaloutcomeallow, deny, require_approval
agentshield_gateway_executions_totaltool, resultcompleted, timeout, or a failure code such as circuit_open
agentshield_gateway_adapter_duration_secondstoolTime inside the adapter
agentshield_gateway_analysis_totalstatusclean, flagged, unavailable
agentshield_relay_outbox_backlog—Events waiting; -1 when unreadable
agentshield_relay_outbox_oldest_seconds—Age of the oldest waiting event

The complete list is on the Prometheus page.

Dashboards and alerts

The Compose observability profile runs Prometheus v3.1.0 and Grafana 11.4.0, pinned by digest, on loopback ports. The AgentShield dashboard and data source are provisioned from files. Eight alert rules ship with Prometheus, covering service availability, gateway errors, open circuits, analyzer availability, injection spikes, outbox lag, and evidence write failures. See Grafana and Monitoring.

No Alertmanager is configured by default. Alerts are visible in Prometheus and Grafana; add an Alertmanager with your own receivers to page someone.

Per-tenant visibility

Operators who need per-organization numbers use the control plane, which applies roles:

  • GET /api/v1/metrics/reliability for per-tool calls, failures, success rate, and latency.
  • GET /api/v1/events and the /api/v1/events/stream server-sent events for activity.
  • GET /api/v1/incidents and GET /api/v1/alerts for detections.

Benchmarks

Go benchmarks measure policy evaluation, signature verification, and a full in-memory authorization; a Python script measures the analyzer. benchmarks/README.md records a baseline with the machine and conditions. CI runs the benchmarks to make sure they still execute.

Direction

Metrics and health cover the current operational needs. Distributed tracing with an OpenTelemetry collector, log shipping, and long-term metric storage are natural extensions; services already emit trace and span ids in their request logs, and the event stream is the integration point for external security tooling.

Was this page helpful?

On this page