ReqLLM.OpenTelemetry
(ReqLLM v1.9.0)
View Source
Bridges ReqLLM request lifecycle telemetry into OpenTelemetry GenAI client spans.
This module listens to the existing [:req_llm, :request, *] events and emits a
single client span per model call. The span follows the OpenTelemetry Generative AI
semantic conventions where ReqLLM has normalized data available, including:
gen_ai.provider.namegen_ai.operation.namegen_ai.request.modelgen_ai.output.typegen_ai.response.finish_reasonsgen_ai.usage.*error.type
Span export remains opt-in at the application level. You still need OpenTelemetry
dependencies and SDK/exporter configuration in your host app. When the OpenTelemetry
API modules are not available, attach/2 returns {:error, :opentelemetry_unavailable}.
For custom tracer integrations that want richer message and tool-call mapping
without binding ReqLLM to a specific OpenTelemetry SDK, see
ReqLLM.Telemetry.OpenTelemetry.
Summary
Functions
Attaches the OpenTelemetry bridge to ReqLLM request lifecycle events.
Returns whether the configured OpenTelemetry adapter is available.
Detaches the OpenTelemetry bridge and clears any in-flight spans for the handler.
Returns the request lifecycle events used by the bridge.
Returns the GenAI span name for a ReqLLM request.
Types
Functions
Attaches the OpenTelemetry bridge to ReqLLM request lifecycle events.
Returns whether the configured OpenTelemetry adapter is available.
@spec detach(term()) :: :ok
Detaches the OpenTelemetry bridge and clears any in-flight spans for the handler.
@spec events() :: [[atom()]]
Returns the request lifecycle events used by the bridge.
Returns the GenAI span name for a ReqLLM request.