Documentation Index
Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt
Use this file to discover all available pages before exploring further.
OtelTracingMiddleware creates event and handler spans with parent-child linking.
Constructor params
tracer: optional explicit OpenTelemetry tracer instance
trace_api: optional explicit opentelemetry.trace module
Setup with EventBus
from abxbus import EventBus
from abxbus.middlewares import OtelTracingMiddleware
bus = EventBus(
name='AppBus',
middlewares=[OtelTracingMiddleware()],
)
import { EventBus } from 'abxbus'
import { OtelTracingMiddleware } from 'abxbus/OtelTracingMiddleware'
const bus = new EventBus('AppBus', {
middlewares: [new OtelTracingMiddleware()],
})
Setup with Sentry
import sentry_sdk
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from sentry_sdk.integrations.opentelemetry import SentrySpanProcessor
from abxbus import EventBus
from abxbus.middlewares import OtelTracingMiddleware
sentry_sdk.init(
dsn='https://<public>@<host>/<project>',
traces_sample_rate=1.0,
)
provider = TracerProvider()
provider.add_span_processor(SentrySpanProcessor())
trace.set_tracer_provider(provider)
bus = EventBus(
name='AppBus',
middlewares=[OtelTracingMiddleware()],
)
Install requirements:
pip install sentry-sdk opentelemetry-api opentelemetry-sdk
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.