Skip to content

feat(cloudflare): Auto-instrument Durable Object classes#22437

Draft
JPeer264 wants to merge 1 commit into
jp/cloudflare-auto-instrument-withsentryfrom
jp/cloudflare-auto-instrument-durableobject
Draft

feat(cloudflare): Auto-instrument Durable Object classes#22437
JPeer264 wants to merge 1 commit into
jp/cloudflare-auto-instrument-withsentryfrom
jp/cloudflare-auto-instrument-durableobject

Conversation

@JPeer264

Copy link
Copy Markdown
Member

Extend the auto-instrument transform to wrap exported Durable Object classes (those named in the wrangler durable_objects bindings) with instrumentDurableObjectWithSentry, alongside the existing default-export withSentry wrapping.

Handles the inline (export class MyDO {}) and specifier (class MyDO {}export { MyDO } / export { Foo as MyDO }) forms, leaves classes already wrapped manually untouched, and warns about configured classes it can't find in the entry (e.g. re-exports from another module, which can't be wrapped in place).

Adds a vite-autoinstrument/durableobject integration suite: a worker whose default handler and Counter Durable Object are both left unwrapped and wrapped at build time via the Vite plugin.

I also added tons of integration tests with couple of gotchas (the majority of additions are actually just tests)

@JPeer264 JPeer264 self-assigned this Jul 21, 2026
@JPeer264 JPeer264 changed the title feat(cloudflare): Auto-instrument the worker entry with withSentry feat(cloudflare): Auto-instrument Durable Object classes Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.76 kB - -
@sentry/browser - with treeshaking flags 26.2 kB - -
@sentry/browser (incl. Tracing) 46.59 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.4 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.39 kB - -
@sentry/browser (incl. Tracing, Replay) 85.83 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.47 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.56 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.22 kB - -
@sentry/browser (incl. Feedback) 44.95 kB - -
@sentry/browser (incl. sendFeedback) 32.56 kB - -
@sentry/browser (incl. FeedbackAsync) 37.69 kB - -
@sentry/browser (incl. Metrics) 28.84 kB - -
@sentry/browser (incl. Logs) 29.06 kB - -
@sentry/browser (incl. Metrics & Logs) 29.76 kB - -
@sentry/react 29.55 kB - -
@sentry/react (incl. Tracing) 48.87 kB - -
@sentry/vue 33.18 kB - -
@sentry/vue (incl. Tracing) 48.56 kB - -
@sentry/svelte 27.78 kB - -
CDN Bundle 30.16 kB - -
CDN Bundle (incl. Tracing) 48.56 kB - -
CDN Bundle (incl. Logs, Metrics) 31.74 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.86 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 71 kB - -
CDN Bundle (incl. Tracing, Replay) 86.06 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.87 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.13 kB - -
CDN Bundle - uncompressed 89.89 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.6 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.75 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.36 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.66 kB - -
@sentry/nextjs (client) 51.38 kB - -
@sentry/sveltekit (client) 47 kB - -
@sentry/core/server 80.3 kB - -
@sentry/core/browser 66.71 kB - -
@sentry/node-core 63.21 kB - -
@sentry/node 125.04 kB - -
@sentry/node (incl. diagnostics channel injection) 150.51 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB -0.01% -2 B 🔽
@sentry/node/light 51.33 kB -0.01% -1 B 🔽
@sentry/node - without tracing 74.91 kB - -
@sentry/aws-serverless 84.16 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 197.75 kB - -
@sentry/cloudflare (withSentry) 486.73 kB - -

View base workflow run

Extend the auto-instrument transform to wrap exported Durable Object classes
(those named in the wrangler `durable_objects` bindings) with
`instrumentDurableObjectWithSentry`, alongside the existing default-export
`withSentry` wrapping.

Handles the inline (`export class MyDO {}`) and specifier
(`class MyDO {}` … `export { MyDO }` / `export { Foo as MyDO }`) forms, leaves
classes already wrapped manually untouched, and warns about configured classes
it can't find in the entry (e.g. re-exports from another module, which can't be
wrapped in place).

Adds a `vite-autoinstrument/durableobject` integration suite: a worker whose
default handler and `Counter` Durable Object are both left unwrapped and wrapped
at build time via the Vite plugin.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/cloudflare-auto-instrument-withsentry branch from e43f7dc to f03fae8 Compare July 21, 2026 15:25
@JPeer264
JPeer264 force-pushed the jp/cloudflare-auto-instrument-durableobject branch from 1d8ee57 to 6fd1b77 Compare July 21, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant