Skip to content

feat(cloudflare): Add batch, exec, and withSession D1 instrumentation - #21292

Merged
JPeer264 merged 4 commits into
developfrom
jp/missing-d1-instrumentations
Jun 24, 2026
Merged

feat(cloudflare): Add batch, exec, and withSession D1 instrumentation#21292
JPeer264 merged 4 commits into
developfrom
jp/missing-d1-instrumentations

Conversation

@JPeer264

@JPeer264JPeer264 commented Jun 2, 2026

Copy link
Copy Markdown
Member

closes#21275
closes JS-2658

This PR does 2 things:

  1. It adds missing methods of D1 and adds a span to each
    • batch, exec, and withSession. withSession is not doing anything as per spec, but instruments its return values prepare and batch
  2. Some Sentry convention updates

AI generated text:

Instrument db.batch(), db.exec(), and db.withSession() methods
that were previously not covered by D1 instrumentation.

@JPeer264JPeer264 self-assigned this Jun 2, 2026
@JPeer264
JPeer264force-pushed the jp/missing-d1-instrumentations branch from dc4ec0c to c7c19ebCompareJune 2, 2026 12:55
@github-actions

github-actionsBot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.47 kB--
@sentry/browser - with treeshaking flags25.91 kB--
@sentry/browser (incl. Tracing)45.97 kB--
@sentry/browser (incl. Tracing + Span Streaming)47.72 kB--
@sentry/browser (incl. Tracing, Profiling)50.76 kB--
@sentry/browser (incl. Tracing, Replay)85.22 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags74.81 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)89.91 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)102.57 kB--
@sentry/browser (incl. Feedback)44.66 kB--
@sentry/browser (incl. sendFeedback)32.26 kB--
@sentry/browser (incl. FeedbackAsync)37.4 kB--
@sentry/browser (incl. Metrics)28.54 kB--
@sentry/browser (incl. Logs)28.78 kB--
@sentry/browser (incl. Metrics & Logs)29.47 kB--
@sentry/react29.27 kB--
@sentry/react (incl. Tracing)48.28 kB--
@sentry/vue32.63 kB--
@sentry/vue (incl. Tracing)47.84 kB--
@sentry/svelte27.5 kB--
CDN Bundle29.89 kB--
CDN Bundle (incl. Tracing)47.89 kB--
CDN Bundle (incl. Logs, Metrics)31.44 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.24 kB--
CDN Bundle (incl. Replay, Logs, Metrics)70.78 kB--
CDN Bundle (incl. Tracing, Replay)85.4 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.68 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)91.19 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.45 kB--
CDN Bundle - uncompressed88.94 kB--
CDN Bundle (incl. Tracing) - uncompressed145.03 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed93.65 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed149 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed218.62 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed264.05 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed268 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed277.75 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed281.69 kB--
@sentry/nextjs (client)50.67 kB--
@sentry/sveltekit (client)46.37 kB--
@sentry/core/server76.5 kB--
@sentry/core/browser63.63 kB--
@sentry/node-core61.51 kB--
@sentry/node122.65 kB-0.01%-1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection)69.95 kB--
@sentry/node/light50.4 kB--
@sentry/node - without tracing73.55 kB+0.01%+2 B 🔺
@sentry/aws-serverless84.74 kB--
@sentry/cloudflare (withSentry) - minified176.92 kB+0.52%+909 B 🔺
@sentry/cloudflare (withSentry)439.66 kB+0.44%+1.89 kB 🔺

View base workflow run

Base automatically changed from jp/deprecate-d1-instrument-via-env to developJune 3, 2026 13:40
@JPeer264
JPeer264force-pushed the jp/missing-d1-instrumentations branch from c7c19eb to c4b6af2CompareJune 15, 2026 16:20
@JPeer264
JPeer264 marked this pull request as ready for review June 16, 2026 09:14
@JPeer264
JPeer264 requested a review from a team as a code ownerJune 16, 2026 09:14
@JPeer264
JPeer264 requested review from andreiborza and mydea and removed request for a teamJune 16, 2026 09:14

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c4b6af2. Configure here.

Comment threaddev-packages/cloudflare-integration-tests/suites/d1/test.ts
@github-actions

Copy link
Copy Markdown
Contributor

👋 @mydea, @andreiborza — Please review this PR when you get a chance!

const runner = createRunner(__dirname)
.ignore('event')
.expect((envelope: Envelope) => {
if (envelopeItemType(envelope) !== 'transaction') return;

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.

q: this would silently pass the test right? seems a bit weird. I think we should just hard fail if we don't have a transaction here, no?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

that is correct. I will add this

@JPeer264
JPeer264 enabled auto-merge (squash) June 24, 2026 08:05
@linear-code

Copy link
Copy Markdown

JS-2658

JPeer264and others added 4 commits June 24, 2026 20:18
Instrument `db.batch()`, `db.exec()`, and `db.withSession()` methods
that were previously not covered by D1 instrumentation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JPeer264
JPeer264force-pushed the jp/missing-d1-instrumentations branch from bfb2367 to 527039eCompareJune 24, 2026 17:18
Comment threaddev-packages/cloudflare-integration-tests/suites/d1/test.ts
@JPeer264
JPeer264 merged commit 2905c3a into developJun 24, 2026
141 of 144 checks passed
@JPeer264
JPeer264 deleted the jp/missing-d1-instrumentations branch June 24, 2026 20:03
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.

Instrument missing D1 methods

2 participants

@JPeer264@andreiborza