Skip to content

feat(cloudflare): Instrument SQL API in sqlite durable objects - #21656

Merged
JPeer264 merged 7 commits into
developfrom
jp/cloudflare-instrument-sql-api
Jun 25, 2026
Merged

feat(cloudflare): Instrument SQL API in sqlite durable objects#21656
JPeer264 merged 7 commits into
developfrom
jp/cloudflare-instrument-sql-api

Conversation

@JPeer264

@JPeer264JPeer264 commented Jun 19, 2026

Copy link
Copy Markdown
Member

closes#20832
closes JS-2445

This instruments sql.exec() for an SQLite DurableObject. It adds a span and a breadcrumb for the exec method.

It was inspired by the postgres integration, that is why the _INTERNAL_sanitizeSqlQuery has been now exported from core. I wanted to also add the span attribute db.query.summary, but the functionality didn't exist and didn't want to make the PR bigger. I'll add another PR for that functionality.

This PR can only be merged once getsentry/sentry-conventions#435 has been merged

@JPeer264JPeer264 self-assigned this Jun 19, 2026
@JPeer264
JPeer264 requested a review from a team as a code ownerJune 19, 2026 12:14
@JPeer264
JPeer264 requested review from andreiborza and mydea and removed request for a teamJune 19, 2026 12:14
@linear-code

Copy link
Copy Markdown

JS-2445

@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 890e3ff. Configure here.

Comment threadpackages/cloudflare/src/instrumentations/instrumentSqlStorage.ts Outdated
Comment threadpackages/cloudflare/src/instrumentations/instrumentSqlStorage.ts Outdated
@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

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/server77.28 kB+1.03%+783 B 🔺
@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--
@sentry/aws-serverless84.74 kB-0.01%-1 B 🔽
@sentry/cloudflare (withSentry) - minified180.31 kB+1.92%+3.39 kB 🔺
@sentry/cloudflare (withSentry)446.24 kB+1.5%+6.58 kB 🔺

View base workflow run

@JPeer264
JPeer264force-pushed the jp/cloudflare-instrument-sql-api branch from 4ece05c to 2c47687CompareJune 22, 2026 11:45
@JPeer264
JPeer264 changed the base branch from develop to jp/query-summaryJune 22, 2026 11:45
@github-actions

Copy link
Copy Markdown
Contributor

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

@JPeer264
JPeer264force-pushed the jp/cloudflare-instrument-sql-api branch from 2c47687 to 03411edCompareJune 24, 2026 08:56
Base automatically changed from jp/query-summary to developJune 24, 2026 10:59
@JPeer264
JPeer264force-pushed the jp/cloudflare-instrument-sql-api branch from 45302a2 to de4a10dCompareJune 24, 2026 16:36
@JPeer264

Copy link
Copy Markdown
MemberAuthor

FYI I removed the addBreadcrumb from the instrumentation. If we think this is useful in the future we can add it, but for now it's gone.

@JPeer264
JPeer264force-pushed the jp/cloudflare-instrument-sql-api branch from cfa1387 to 3fa0407CompareJune 24, 2026 20:27
@JPeer264
JPeer264 merged commit b72a360 into developJun 25, 2026
554 of 556 checks passed
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.

Cloudflare instrument SQL API

2 participants

@JPeer264@andreiborza