Skip to content

Commit cfc41ca

Browse files
JPeer264claude
andcommitted
feat(cloudflare): Instrument bundled packages via orchestrion diagnostics channels
Integrate the server-utils orchestrion channel-integration mechanism into the Cloudflare SDK, so bundled npm packages (e.g. `mysql`) are traced without monkey-patching, which workerd doesn't support anyway. - Add the `@sentry/cloudflare/vite` plugin, which runs the orchestrion transform (injecting `diagnostics_channel.tracingChannel` calls) and injects a registration module that puts the channel-subscriber integrations on the global marker. Workers built without the plugin don't ship that code. - `getDefaultIntegrations()` reads the registered integrations from the marker at `init()`, activating only those whose module was actually transformed, and warns (debug only, once per isolate) about modules whose transform failed. - Add a Cloudflare + MySQL e2e test app exercising real `db` spans in workerd. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7e8f420 commit cfc41ca

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/cloudflare/src/sdk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
dedupeIntegration,
66
functionToStringIntegration,
77
getIntegrationsToSetup,
8+
GLOBAL_OBJ,
89
inboundFiltersIntegration,
910
initAndBind,
1011
linkedErrorsIntegration,
@@ -27,7 +28,7 @@ import { defaultStackParser } from './vendor/stacktrace';
2728
* TODO(v11): Use `@sentry/server-utils/orchestrion` once we move to `nodejs_compat` by default
2829
*/
2930
function getRegisteredChannelIntegrations(): Integration[] {
30-
const marker = globalThis.__SENTRY_ORCHESTRION__;
31+
const marker = GLOBAL_OBJ.__SENTRY_ORCHESTRION__;
3132
const registered = marker?.integrations || [];
3233

3334
return registered.map(factory => factory());

0 commit comments

Comments
 (0)