Description
Integrate OpenTelemetry span export into TealEngine so every policy decision is traceable end-to-end.
Problem
TealEngine already generates correlation IDs compatible with OpenTelemetry trace format, but doesn't actually export spans. Teams using Jaeger, Datadog, or Grafana Tempo can't visualize the governance decision path.
Requirements
• Add optional @opentelemetry/api peer dependency
• Create spans for: policy evaluation start/end, each module evaluation, guardrail checks, cost calculation
• Attach decision metadata as span attributes (action, risk_score, reason_codes)
• Support both automatic instrumentation (if OTel SDK is initialized) and manual span injection
• Add a TealOTelPlugin that can be registered with TealEngineV12's module registry
• Export should be zero-cost when OTel is not configured (no-op tracer)
Technical Considerations
- Must not add
@opentelemetry/api as a hard dependency (peer dep only)
- Use semantic conventions for span naming
- Consider span links for multi-agent correlation
- Baggage propagation for cross-service governance decisions
Validation
• Unit tests with mock tracer
• Example showing Jaeger integration
• Verify zero overhead when OTel is not initialized
Acceptance Criteria
Description
Integrate OpenTelemetry span export into TealEngine so every policy decision is traceable end-to-end.
Problem
TealEngine already generates correlation IDs compatible with OpenTelemetry trace format, but doesn't actually export spans. Teams using Jaeger, Datadog, or Grafana Tempo can't visualize the governance decision path.
Requirements
• Add optional
@opentelemetry/apipeer dependency• Create spans for: policy evaluation start/end, each module evaluation, guardrail checks, cost calculation
• Attach decision metadata as span attributes (action, risk_score, reason_codes)
• Support both automatic instrumentation (if OTel SDK is initialized) and manual span injection
• Add a
TealOTelPluginthat can be registered with TealEngineV12's module registry• Export should be zero-cost when OTel is not configured (no-op tracer)
Technical Considerations
@opentelemetry/apias a hard dependency (peer dep only)Validation
• Unit tests with mock tracer
• Example showing Jaeger integration
• Verify zero overhead when OTel is not initialized
Acceptance Criteria