Add LiveKit Agents instrumentation coverage + warn about the OTel SDK v1/v2 setTracerProvider mismatch #44
samuelarbolai
started this conversation in
Ideas & Improvements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe your idea or feedback
The instrumentation guidance (
references/instrumentation.md) lists framework integrations for OpenAI, LangChain, LlamaIndex, Vercel AI SDK, and LiteLLM — but not LiveKit Agents (Node.js).Wiring
@langfuse/otelinto a LiveKit Agents worker hits a non-obvious, costly trap.@langfuse/otel(v5) requires OpenTelemetry JS SDK v2 (@opentelemetry/sdk-trace-node@2.x). But@livekit/agents@1.2.0'ssetTracerProvider(provider, { metadata })does:addSpanProcessor()was removed in SDK v2 (providers are immutable; processors are constructor-only —NodeTracerProvider.prototype.addSpanProcessorisundefined). So the metadata path throwsTypeError: provider.addSpanProcessor is not a function, and because it runs inside the agent's jobentry, it crashes the worker on every call. The no-metadata path (setTracerProvider(provider)) is fine. We shipped this once and every flow crashed on entry until we wrapped the call non-fatally.This likely affects any host framework whose tracer-provider hook is written against the removed v1
addSpanProcessorAPI.What would the ideal outcome look like?
telemetrynamespace from@livekit/agents(there is no./telemetrysubpath export), build aNodeTracerProviderwithLangfuseSpanProcessor, and pass it totelemetry.setTracerProvider(provider).setTracerProvider/provider hook, verify it doesn't rely on the removed v1addSpanProcessorAPI before pairing it with@langfuse/otel(SDK v2), and wrap provider registration defensively so a tracing failure can't crash the host process.Beta Was this translation helpful? Give feedback.
All reactions