Sycophant.OpenTelemetry
(sycophant v0.4.2)
Copy Markdown
OpenTelemetry bridge for Sycophant telemetry events.
Attaches :telemetry handlers that translate Sycophant request and embedding
events into OpenTelemetry spans following the GenAI semantic conventions.
Setup
Sycophant.OpenTelemetry.setup()Custom Attributes
Pass an attribute_mapper function to enrich spans with application-specific
attributes. The function receives the telemetry metadata and must return a
keyword list of {key, value} tuples:
Sycophant.OpenTelemetry.setup(
attribute_mapper: fn metadata ->
[{"app.tenant_id", metadata[:tenant_id]}]
end
)Requires the opentelemetry_telemetry optional dependency.
Summary
Functions
Attaches OpenTelemetry handlers to Sycophant telemetry events.
Detaches all OpenTelemetry handlers.
Functions
@spec setup(keyword()) :: :ok | {:error, :opentelemetry_not_available}
Attaches OpenTelemetry handlers to Sycophant telemetry events.
Returns :ok on success, or {:error, :opentelemetry_not_available} if
the opentelemetry_telemetry dependency is not loaded.
Options
:attribute_mapper- a function(map() -> [{String.t(), term()}])whose return values are merged into span attributes.
@spec teardown() :: :ok
Detaches all OpenTelemetry handlers.