History

fix(cloud): disable Sentry OTEL setup so otel-cf-workers can own the provider

@sentry/cloudflare registers its own ProxyTracerProvider globally (even when tracesSampleRate is 0) via its OpenTelemetry compatibility shim. That clobbers the WorkerTracerProvider that otel-cf-workers installs, causing every request to throw 'The global tracer is not of type WorkerTracer' and the worker to 1101 on every route. Passing skipOpenTelemetrySetup: true to the Sentry config opts out of that shim. Sentry error capture still works — it uses its own transport and scope management, independent of OTEL. otel-cf-workers is then free to own the provider and flush spans reliably via ctx.waitUntil.

Rhys Sullivan committed 7 months ago

Commit 28d8ece1 parent 9f3982e1 file · +5 −0Browse files

Unified · Split

apps/cloud/src/server.ts+5−0
@@ -35,6 +35,11 @@ export default Sentry.withSentry( · 34 unmodified lines
35 tracesSampleRate: 0,35 tracesSampleRate: 0,
36 enableLogs: true,36 enableLogs: true,
37 sendDefaultPii: true,37 sendDefaultPii: true,
38 // otel-cf-workers owns the global TracerProvider. Sentry's OTEL compat
39 // shim registers a ProxyTracerProvider of its own, which prevents
40 // otel-cf-workers from finding its WorkerTracer and breaks the whole
41 // request path with "global tracer is not of type WorkerTracer".
42 skipOpenTelemetrySetup: true,
38 }),43 }),
39 instrumentedHandler,44 instrumentedHandler,
40);45);