Skip to content

Metrics, conditions and audit events

Gateway metrics

On :9090/metrics:

Metric Labels
leash_gateway_requests_total namespace, policy, kind (model or mcp), outcome
leash_gateway_tokens_total namespace, policy, provider, model, direction (input or output)

outcome is one of allowed, denied, budget_exhausted, approved, approval_denied or approval_error.

# Tokens per policy over the last day
sum by (namespace, policy) (increase(leash_gateway_tokens_total[1d]))
# Refusals per minute
sum by (policy, outcome) (rate(leash_gateway_requests_total{outcome!~"allowed|approved"}[5m])) * 60

The operator serves the standard controller-runtime metrics on :8080/metrics.

AgentPolicy conditions

Condition True means Reasons
Ready The policy is written to the network backend Enforced, Frozen, InvalidPolicy, BackendError, ScaleFailed
Degraded Some rules can’t be enforced by this backend, and fail closed UnsupportedRules, AllRulesEnforced
EgressWidened Other network policies also allow egress from these agents OtherPoliciesAllowEgress, NoOtherPolicies

AgentIdentity conditions

Condition True means Reasons
Ready The Vault policy, role and entity are in place Active, Frozen, RevokeFailed, InvalidIdentity, ServiceAccountError, VaultNotConfigured, VaultError, PolicyNotFound
UnguardedPods Pods use this ServiceAccount without the AgentPolicy’s guardrails UnguardedPods, AllPodsGuarded
PodsWithoutIdentity Agent pods run as a different ServiceAccount PodsWithoutIdentity, AllAgentsUseIdentity

Kubernetes events

The operator also records events on the resources, such as Frozen, Unfrozen, ScaledToZero, Restored, LeasesRevoked, RevokeFailed and VaultCleanupFailed:

Terminal window
kubectl -n agents get events --field-selector involvedObject.kind=AgentPolicy

Audit events

Every gateway decision and kill-switch change is a JSON line on stdout. The fields and how to ship them to Loki are in Audit trail and dashboards.