Documentation
¶
Overview ¶
Package otel adapts the core hook.Hooks callbacks to OpenTelemetry spans and attributes. It is the only place that imports the otel packages; core stays free of any observability backend. Initialize a tracer provider in main for spans to be exported; with no provider, otel uses a no-op tracer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHooks ¶
NewHooks returns hook.Hooks that emit OpenTelemetry spans for tool calls and record errors and gate/authorize decisions as span attributes. It uses the global tracer provider; initialize one (e.g. an OTLP exporter) in main for spans to be exported. Without a provider, otel uses a no-op tracer.
func RegisterBusMetrics ¶ added in v0.1.13
RegisterBusMetrics observes b through mp, such as the global MeterProvider (a no-op one unless Setup exported metrics): per lane smcp.bus.lane.inflight, .queued, .limit and the cumulative .rejected and .completed (attribute lane); smcp.bus.io.used and .size (attribute pool: io or aux); and smcp.bus.tasks per background task name (attribute task). The returned function stops observing.
func Setup ¶ added in v0.1.6
Setup initializes the global TracerProvider and MeterProvider from the standard OTLP environment variables so the spans emitted by NewHooks and the metrics RegisterBusMetrics observes on the global MeterProvider are actually exported. Traces are exported when OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is set, metrics when OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT is; otherwise the no-op global providers stay. The exporters speak OTLP over HTTP/protobuf; endpoint, headers, and TLS come from the standard OTEL_EXPORTER_OTLP_* variables read by the exporters themselves.
Types ¶
This section is empty.