Skip to content

Add OpenTelemetry (OTel) span export for governance events #8

@ryanwi

Description

@ryanwi

Motivation

agent-control-plane emits rich EventKind events (session lifecycle, budget exhaustion, model access denial, risk escalation, tier routing decisions, guardrail hits, etc.) but consumers currently have no standardized way to route these into observability backends.

Adding OTel span export would let any consuming application wire governance events into Langfuse, Jaeger, Honeycomb, or any OTel-compatible backend without writing custom exporters.

Proposal

Wrap EventKind emissions as OTel spans/attributes:

  • Each governance event becomes a span or span event on the active trace
  • Key attributes: session_id, action_tier (AUTO_APPROVE / STEER / DENY), event_kind, policy_snapshot_id
  • TokenBudgetTracker and SessionRiskAccumulator events tagged with their respective metrics

Implementation should be additive — OTel export is opt-in (no hard dep on opentelemetry-sdk), activated by passing a tracer or enabling via config.

Consumer Use Case

In AlphaBond, this would enable correlating LLM call traces (via Langfuse) with CP governance outcomes — e.g., prompt version → STEER routing → guardrail hit — in a single unified trace view. See ryanwi/alphabond#279.

Scope

  • Define which EventKind values map to spans vs. span events
  • Decide opt-in mechanism (tracer injection vs. env flag)
  • Add opentelemetry-api as optional dep
  • Instrument AsyncControlPlaneFacade and AsyncResilientControlPlane
  • Document integration pattern for consumers

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions