SIGN IN SIGN UP

fix(llms): make Langfuse tracer detection survive minified release builds (#13680)

* fix(llms): recognize direct tracer providers

* fix(llms): make Langfuse tracer detection survive minified release builds

Release binaries are compiled with minify enabled, which renames classes,
so initializeLangfuseTelemetry's constructor-name guard never matched
"ProxyTracerProvider" and silently returned readiness=false in every
production build (hub log: "creating span processor" followed by
"initialized readiness=false" with no branch message in between). Dev runs
execute unminified source, which is why the same env vars worked there.

Replace every constructor-name comparison with checks that survive
minification: detect the proxy structurally via getDelegate, distinguish a
recording provider from the no-op fallback by its lifecycle methods, and
confirm our NodeTracerProvider registration by object identity. When a
foreign provider already owns the global slot, attach the Langfuse span
processor to it when it accepts processors, and otherwise shut down the
orphaned provider and report the rejection instead of bailing silently.

Verified by bundling the module with Bun minify:true against the real
OpenTelemetry packages: the previous code reproduces readiness=false
(provider class name mangles to "H2"), the new code initializes with
readiness=true.
B
Bee committed
1986fa56de5dc91d635ef3a696136f6dc11799dd
Parent: 27350f2
Committed by GitHub <noreply@github.com> on 8/29/2026, 2:44:15 AM