OpenTelemetry Trace Export — Gen AI semantic conventions

2026-03-23

observability

What We Built

OTLP/HTTP span exporter with Gen AI semantic conventions and BR custom attributes. Lazy initialization — zero overhead when not configured. Batch export with configurable flush interval.

How It Works

Set OTEL_EXPORTER_OTLP_ENDPOINT to enable. Each completion request generates a span with Gen AI attributes (gen_ai.system, gen_ai.request.model, gen_ai.usage.*) and BR-specific attributes (br.cost_usd, br.cache_hit, br.routing_strategy).

Lockstep Checklist

  • [x] API: GET /v1/config/otel returns current config status
  • [x] Tests: 10 tests for span creation, attributes, timing, error handling
  • [x] Docs: Ship log