Skip to content

fix(core): Summarize SQLite upserts so Durable Object cf_ spans stay filtered - #22649

Merged
JPeer264 merged 1 commit into
developfrom
jp/filter-optional-sql-spans
Jul 27, 2026
Merged

fix(core): Summarize SQLite upserts so Durable Object cf_ spans stay filtered#22649
JPeer264 merged 1 commit into
developfrom
jp/filter-optional-sql-spans

Conversation

@JPeer264

Copy link
Copy Markdown
Member

getSqlQuerySummary only matched plain INSERT INTO, so SQLite upsert forms (INSERT OR REPLACE INTO, INSERT OR IGNORE INTO, REPLACE INTO) fell through to the first-word fallback and summarized as bare INSERT with no table target. The Cloudflare Durable Object filter (targetsCloudflareInternalTable) checks the summary for cf_-prefixed tables, so agents-framework queries like INSERT OR REPLACE INTO cf_agents_mcp_servers ... leaked through as zero-signal db.query spans named just INSERT.

Extend the summarizer to the full SQLite conflict-clause grammar (INSERT|UPDATE OR ROLLBACK|ABORT|FAIL|IGNORE|REPLACE, plus the REPLACE INTO shorthand). The clause is stripped like INTO/FROM so upserts share the plain-operation summary (INSERT cf_agents_state), keeping span names low-cardinality.

…y filtered

`getSqlQuerySummary` only matched plain `INSERT INTO`, so SQLite upsert forms
(`INSERT OR REPLACE INTO`, `INSERT OR IGNORE INTO`, `REPLACE INTO`) fell
through to the first-word fallback and summarized as bare `INSERT` with no
table target. The Cloudflare Durable Object filter
(`targetsCloudflareInternalTable`) checks the summary for `cf_`-prefixed
tables, so agents-framework queries like
`INSERT OR REPLACE INTO cf_agents_mcp_servers ...` leaked through as
zero-signal `db.query` spans named just `INSERT`.

Extend the summarizer to the full SQLite conflict-clause grammar
(`INSERT|UPDATE OR ROLLBACK|ABORT|FAIL|IGNORE|REPLACE`, plus the
`REPLACE INTO` shorthand). The clause is stripped like INTO/FROM so upserts
share the plain-operation summary (`INSERT cf_agents_state`), keeping span
names low-cardinality.

Co-Authored-By: Claude <noreply@anthropic.com>
@JPeer264 JPeer264 self-assigned this Jul 27, 2026
@JPeer264
JPeer264 requested a review from a team as a code owner July 27, 2026 07:10
@JPeer264
JPeer264 requested review from andreiborza and isaacs and removed request for a team July 27, 2026 07:10
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.95 kB - -
@sentry/browser - with treeshaking flags 26.39 kB - -
@sentry/browser (incl. Tracing) 46.41 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.18 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.21 kB - -
@sentry/browser (incl. Tracing, Replay) 85.69 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.33 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.4 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.06 kB - -
@sentry/browser (incl. Feedback) 45.13 kB - -
@sentry/browser (incl. sendFeedback) 32.74 kB - -
@sentry/browser (incl. FeedbackAsync) 37.8 kB - -
@sentry/browser (incl. Metrics) 29.04 kB - -
@sentry/browser (incl. Logs) 29.26 kB - -
@sentry/browser (incl. Metrics & Logs) 29.97 kB - -
@sentry/react 29.75 kB - -
@sentry/react (incl. Tracing) 48.71 kB - -
@sentry/vue 33.38 kB - -
@sentry/vue (incl. Tracing) 48.4 kB - -
@sentry/svelte 27.97 kB - -
CDN Bundle 30.28 kB - -
CDN Bundle (incl. Tracing) 48.26 kB - -
CDN Bundle (incl. Logs, Metrics) 31.85 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.58 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 71.13 kB - -
CDN Bundle (incl. Tracing, Replay) 85.83 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.89 kB - -
CDN Bundle - uncompressed 90.15 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.22 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.86 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.2 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.62 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.46 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.11 kB - -
@sentry/nextjs (client) 51.24 kB - -
@sentry/sveltekit (client) 46.84 kB - -
@sentry/core/server 80.1 kB +0.06% +44 B 🔺
@sentry/core/browser 52.01 kB - -
@sentry/node 123.14 kB +0.01% +1 B 🔺
@sentry/node (incl. diagnostics channel injection) 167.14 kB +0.01% +1 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 73.31 kB +0.01% +1 B 🔺
@sentry/aws-serverless 82.82 kB - -
@sentry/cloudflare (withSentry) - minified 197.17 kB +0.06% +114 B 🔺
@sentry/cloudflare (withSentry) 484.86 kB +0.03% +126 B 🔺

View base workflow run

@JPeer264
JPeer264 merged commit a3c20ca into develop Jul 27, 2026
280 checks passed
@JPeer264
JPeer264 deleted the jp/filter-optional-sql-spans branch July 27, 2026 15:56
JPeer264 added a commit that referenced this pull request Jul 28, 2026
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.

2 participants