Skip to content

ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data - #5933

Open
jamescrosswell wants to merge 6 commits into
mainfrom
ai/dc-5433-database-0436b4
Open

jamescrosswell wants to merge 6 commits into
mainfrom
ai/dc-5433-database-0436b4

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

This PR removes the experimental DataCollectionOptions.DatabaseQueryData option. Nothing in .NET collects the data it controls, so setting it had no effect. #5955 brings it back with the first integration that collects query parameters.

Part of #5420 (Phase 2).

Closes #5433

Why remove it instead of gating the SQL statement

The spec scopes databaseQueryData to bound query parameters, write payloads and returned result data. Query statements (db.query.text) and structural metadata are explicitly outside it. Our SqlClient, EF Core and EF6 integrations attach the statement and structural metadata, and nothing else.

#5433 settled on option 2: treat the raw, unsanitized CommandText as gated data until a sanitizer exists. This PR first implemented that. Checking the other SDKs reversed it:

  • sentry-python uses the option for data .NET doesn't collect. It gates bound parameter values (db.params in record_sql_queries), MongoDB values, Redis arguments, and ClickHouse parameters and results. The statement is always sent, exactly as the driver received it.
  • sentry-java made the same change and then backed it out. feat(database): [Data Collection 5] Apply query policy sentry-java#5801 first gated the statement on JDBC and Android SQLite spans. A later commit in the same PR reverted that, because statements are outside the option and those integrations collect nothing it covers. Java kept the option with no consumer. feat(database): Capture query data behind dataCollection sentry-java#6021 says so, and plans to capture bind values behind it in the next major version.
  • sentry-go always sends the statement, after a SQL lexer replaces its literals with ?. It has no DatabaseQueryData option.

Python and Java send statements that are just as unsanitized as .NET's. Gating CommandText would have made .NET the only SDK that drops the statement. Keeping the option without a consumer, as Java does, would leave .NET users with a setting that does nothing. #5853 removed the other categories that had no consumer for the same reason, and this does the same here.

Notes for review

  • There is no ! in the title. DataCollectionOptions is [Experimental], and craft treats ! as a major version bump.
  • The removal is a single commit, 83a1a5e. It has the same diff as this PR against main, so DataCollection: capture database query parameters and reintroduce DatabaseQueryData #5955 can start by reverting it.
  • The net8.0, net9.0 and net4.8 API snapshots were edited by hand, removing the same line the net10.0 and net11.0 test runs removed. Those frameworks don't run on macOS. CI's Windows API-approval job checks net4.8.
  • Sanitizing statements, as Go does, is still the end state the spec describes. It is a separate concern from this option.

🤖 Generated with Claude Code

…tabase spans and EF6 breadcrumbs

The raw CommandText attached as the SqlClient, EF Core and EF6 span
descriptions, and as EF6 breadcrumbs, is now dropped when an app calls
ConfigureDataCollection with DatabaseQueryData = false.

DatabaseQueryData bridges to true when DataCollection is not configured:
the statement was always attached regardless of SendDefaultPii, and spec
0.16.0 requires keeping legacy behaviour until the user opts in.

Closes #5433

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.70%. Comparing base (04c1c8d) to head (83a1a5e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5933      +/-   ##
==========================================
- Coverage   77.70%   77.70%   -0.01%     
==========================================
  Files         535      535              
  Lines       19731    19727       -4     
  Branches     3934     3932       -2     
==========================================
- Hits        15332    15328       -4     
  Misses       3544     3544              
  Partials      855      855              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jamescrosswell and others added 2 commits November 16, 2026 14:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yData

Reverses option 2 from #5433. sentry-python, sentry-java and sentry-go all
send the statement whatever databaseQueryData says, and the spec scopes the
category to bound parameters, write payloads and result data. .NET collects
none of those, so DatabaseQueryData has no effect yet; the XML docs now say so,
and tests pin the statement on SqlClient, EF Core and EF6 spans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamescrosswell jamescrosswell changed the title feat: DataCollection.DatabaseQueryData now gates SQL statements on database spans and EF6 breadcrumbs docs: DataCollection.DatabaseQueryData doesn't control SQL statements Nov 18, 2026
jamescrosswell and others added 3 commits November 18, 2026 14:01
They documented and tested DatabaseQueryData as having no effect; the option
is being removed instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in .NET collects what the option controls: bound query parameters,
write payloads or returned result data. Statements are outside it per the
spec. Reverting this commit restores the option, its bindable entry, the
resolver accessor and their tests, for the integration that first collects
query parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamescrosswell jamescrosswell changed the title docs: DataCollection.DatabaseQueryData doesn't control SQL statements ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data Nov 18, 2026
@jamescrosswell
jamescrosswell marked this pull request as ready for review November 18, 2026 01:37
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataCollection phase 2: gate database query data

1 participant