Observability¶
Event bus, tracing, and OpenTelemetry integration.
EventBus Protocol¶
EventBus ¶
InMemoryEventBus¶
InMemoryEventBus ¶
Default event bus -- fire-and-forget async callbacks.
Callbacks that raise exceptions are silently ignored (fire-and-forget). Supports both sync and async callbacks.
Tracer Protocol¶
Tracer ¶
Bases: Protocol
Tracing interface for spans.
ConsoleTracer¶
ConsoleTracer ¶
OTelExporter¶
OTelExporter ¶
Bridges Cognitia EventBus events to OpenTelemetry spans.
Follows OTel GenAI Semantic Conventions (v1.37+). Each LLM call and tool call becomes an OTel span with standard attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracer_provider | Any | Optional OTel TracerProvider. If | None |
service_name | str | Service name for the tracer. Default: | 'cognitia' |
runtime_name | str | None | Optional runtime identifier (e.g. | None |
session_id | str | None | Optional session identifier for correlating spans across turns. | None |
attach ¶
Subscribe to EventBus events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_bus | Any | EventBus to subscribe to. If | None |
detach ¶
Unsubscribe from all events and end any lingering spans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_bus | Any | EventBus to unsubscribe from. If | None |