Policy Engine Observability

This guide is the operations reference for instrumenting and monitoring the Stella Ops Policy Engine. It catalogs the metrics, logs, traces, dashboards, alerts, and sampling controls the service emits, and the incident workflow operators follow when a policy run misbehaves. Read it before standing up dashboards or wiring alert rules for the Policy Engine.

Audience: Observability Guild, SRE/Platform operators, Policy Guild.
Scope: Metrics, logs, traces, dashboards, alerting, sampling, and incident workflows for the Policy Engine service (Sprint 20).
Prerequisites: Policy Engine v2 deployed with OpenTelemetry exporters enabled (observability:enabled=true in config).


1 · Instrumentation Overview


2 · Metrics

2.1 Run Pipeline

MetricTypeLabelsNotes
policy_run_secondsHistogramtenant, policy, mode (full, incremental, simulate)P95 target ≤ 5 min incremental, ≤ 30 min full.
policy_run_queue_depthGaugetenantNumber of pending jobs per tenant (updated each enqueue/dequeue).
policy_run_failures_totalCountertenant, policy, reason (err_pol_*, network, cancelled)Aligns with error codes.
policy_run_retries_totalCountertenant, policyHelps identify noisy sources.
policy_run_inputs_pending_bytesGaugetenantSize of buffered change batches awaiting run.

2.2 Evaluator Insights

MetricTypeLabelsNotes
policy_rules_fired_totalCountertenant, policy, ruleIncrement per rule match (sampled).
policy_vex_overrides_totalCountertenant, policy, vendor, justificationTracks VEX precedence decisions.
policy_suppressions_totalCountertenant, policy, action (ignore, warn, quiet)Audits suppression usage.
policy_selection_batch_duration_secondsHistogramtenant, policyMeasures joiner performance.
policy_materialization_conflicts_totalCountertenant, policyNon-zero indicates optimistic concurrency retries.

2.3 API Surface

MetricTypeLabelsNotes
policy_api_requests_totalCounterendpoint, method, statusExposed via Minimal API instrumentation.
policy_api_latency_secondsHistogramendpoint, methodBudget ≤ 250 ms for GETs, ≤ 1 s for POSTs.
policy_api_rate_limited_totalCounterendpointTied to throttles (429).

2.4 Queue & Change Streams

MetricTypeLabelsNotes
policy_queue_leases_activeGaugetenantNumber of leased jobs.
policy_queue_lease_expirations_totalCountertenantAlerts when workers fail to ack.
policy_delta_backlog_age_secondsGaugetenant, source (concelier, excititor, sbom)Age of oldest unprocessed change event.

3 · Logs


4 · Traces


5 · Dashboards

5.1 Policy Runs Overview

Widgets:

5.2 Rule Impact & VEX

5.3 Simulation & Approval Health

Replace these panel descriptions with Grafana screenshots once the dashboards land (store them under ../assets/policy-observability/*.png).


6 · Alerting

AlertConditionSuggested Action
PolicyRunSlaBreachpolicy_run_seconds{mode="incremental"} P95 > 300 s for 3 windowsCheck queue depth, upstream services, scale worker pool.
PolicyQueueStuckpolicy_delta_backlog_age_seconds > 600Investigate change stream connectivity.
DeterminismMismatchRun status failed with ERR_POL_004 OR CI replay diffSwitch to incident sampling, gather replay bundle, notify Policy Guild.
SimulationDriftCLI/CI simulation exit 20 (blocking diff) over thresholdReview policy changes before approval.
VexOverrideSpikepolicy_vex_overrides_total > configured baseline (per vendor)Verify upstream VEX feed; ensure justification codes expected.
SuppressionSurgepolicy_suppressions_total increase > 3σ vs baselineAudit new suppress rules; check approvals.

Alerts integrate with Notifier channels (policy.alerts) and Ops on-call rotations.


7 · Incident Mode & Forensics


8 · Integration Points


9 · Compliance Checklist



Last updated: 2025-10-26 (Sprint 20).