OtelTracingMiddleware creates event and handler spans with parent-child linking.
Constructor params
tracer/Tracer: optional explicit OpenTelemetry tracer instance.trace_api: optional explicitopentelemetry.tracemodule in Python/TypeScript.root_span_attributes/RootSpanAttributes: attributes added to top-level event spans.
Setup with EventBus
- Python
- TypeScript
- Go
- Rust
Setup with Sentry
- Python
- Rust
Behavior
- Starts an event span when an event starts and ends it on completion.
- Starts one child span per handler execution.
- Records handler exceptions on handler spans.
- Links child events to parent handler spans where available.
- With Sentry OpenTelemetry integration enabled, these spans are exported to Sentry performance traces.