feat(cloudflare): Auto-instrument Durable Object classes#22437
Draft
JPeer264 wants to merge 1 commit into
Draft
Conversation
Contributor
size-limit report 📦
|
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
force-pushed
the
jp/cloudflare-auto-instrument-withsentry
branch
from
July 21, 2026 15:25
e43f7dc to
f03fae8
Compare
JPeer264
force-pushed
the
jp/cloudflare-auto-instrument-durableobject
branch
from
July 21, 2026 15:25
1d8ee57 to
6fd1b77
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend the auto-instrument transform to wrap exported Durable Object classes (those named in the wrangler
durable_objectsbindings) withinstrumentDurableObjectWithSentry, alongside the existing default-exportwithSentrywrapping.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/durableobjectintegration suite: a worker whose default handler andCounterDurable 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)