Skip to content

feat(cloudflare): Auto instrument D1 based on env - #21276

Merged
JPeer264 merged 4 commits into
developfrom
jp/deprecate-d1-instrument-via-env
Jun 3, 2026
Merged

feat(cloudflare): Auto instrument D1 based on env#21276
JPeer264 merged 4 commits into
developfrom
jp/deprecate-d1-instrument-via-env

Conversation

@JPeer264

Copy link
Copy Markdown
Member

closes#20862
closes JS-2462

Deprecate instrumentD1WithSentry in favor of automatic D1 instrumentation via instrumentEnv. Add isD1Database duck-type check and instrumentD1 with ensureInstrumented to prevent double instrumentation.


The original ticket also states the following, which is outsourced into its own ticket:

batch, exec and withSession are not instrumented.

@JPeer264JPeer264 self-assigned this Jun 2, 2026
@linear-code

Copy link
Copy Markdown

JS-2462

@github-actions

github-actionsBot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.2 kB--
@sentry/browser - with treeshaking flags25.65 kB--
@sentry/browser (incl. Tracing)45.25 kB--
@sentry/browser (incl. Tracing + Span Streaming)47.48 kB--
@sentry/browser (incl. Tracing, Profiling)50.24 kB--
@sentry/browser (incl. Tracing, Replay)84.87 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags74.44 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)89.58 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)102.2 kB--
@sentry/browser (incl. Feedback)44.36 kB--
@sentry/browser (incl. sendFeedback)32.02 kB--
@sentry/browser (incl. FeedbackAsync)37.11 kB--
@sentry/browser (incl. Metrics)28.27 kB--
@sentry/browser (incl. Logs)28.51 kB--
@sentry/browser (incl. Metrics & Logs)29.22 kB--
@sentry/react29.03 kB--
@sentry/react (incl. Tracing)47.52 kB--
@sentry/vue32.22 kB--
@sentry/vue (incl. Tracing)47.17 kB--
@sentry/svelte27.23 kB--
CDN Bundle29.57 kB--
CDN Bundle (incl. Tracing)47.82 kB--
CDN Bundle (incl. Logs, Metrics)31.08 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.06 kB--
CDN Bundle (incl. Replay, Logs, Metrics)70.36 kB--
CDN Bundle (incl. Tracing, Replay)85.22 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.39 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)91.08 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.23 kB--
CDN Bundle - uncompressed87.7 kB--
CDN Bundle (incl. Tracing) - uncompressed144.13 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed92.19 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.88 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed217 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed262.99 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.74 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.69 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.42 kB--
@sentry/nextjs (client)50.05 kB--
@sentry/sveltekit (client)45.71 kB--
@sentry/core/server75.94 kB--
@sentry/core/browser63.09 kB--
@sentry/node-core61.7 kB-0.01%-2 B 🔽
@sentry/node130.4 kB+0.01%+1 B 🔺
@sentry/node - without tracing74.06 kB+0.01%+2 B 🔺
@sentry/aws-serverless86.26 kB--
@sentry/cloudflare (withSentry) - minified173.59 kB+1.02%+1.74 kB 🔺
@sentry/cloudflare (withSentry)433.61 kB+0.96%+4.12 kB 🔺

View base workflow run

JPeer264and others added 2 commits June 2, 2026 10:28
Deprecate `instrumentD1WithSentry` in favor of automatic D1
instrumentation via `instrumentEnv`. Add `isD1Database` duck-type
check and `instrumentD1` with `ensureInstrumented` to prevent
double instrumentation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JPeer264
JPeer264force-pushed the jp/deprecate-d1-instrument-via-env branch from f139295 to 59c5ec0CompareJune 2, 2026 08:44
@JPeer264
JPeer264 marked this pull request as ready for review June 2, 2026 11:37
@JPeer264
JPeer264 requested a review from a team as a code ownerJune 2, 2026 11:37
@JPeer264
JPeer264 requested review from andreiborza, isaacs, mydea and nicohrubec and removed request for a team and mydeaJune 2, 2026 11:37
Comment on lines +151 to +152
* @deprecated `withSentry()` automatically instruments all D1 bindings via `env`
* so this function is not needed anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Maybe we can call out that this will go away in the next major?

…cation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JPeer264
JPeer264 enabled auto-merge (squash) June 3, 2026 13:40
@JPeer264
JPeer264 merged commit 40b260b into developJun 3, 2026
267 of 270 checks passed
@JPeer264
JPeer264 deleted the jp/deprecate-d1-instrument-via-env branch June 3, 2026 13:40
Sign up for freeto 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.

Deprecate instrumentD1WithSentry and instrument via ENV variables

2 participants

@JPeer264@andreiborza