Skip to content

Add OpenTelemetry trace export for TealEngine decisions #120

@nagasatish007

Description

@nagasatish007

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

  • Spans exported for each governance decision
  • Works with standard OTel collectors (Jaeger, OTLP)
  • Zero runtime cost when OTel is not configured
  • Documentation with setup example

Metadata

Metadata

Labels

advancedneeds advanced featuresenhancementNew feature or requestobservabiltyobservability feature required
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions