Repository navigation
Description
Part of #5420. Phase 2 — consumer migration (new gating; default true keeps it behavior-neutral).
Gate database query data on resolved DatabaseQueryData:
src/Sentry.DiagnosticSource/Internal/DiagnosticSource/SentrySqlListener.cs:213— rawCommandTextas span description (currently unconditional).EFCommandDiagnosticSourceHelper.cs,EFQueryCompilerDiagnosticSourceHelper.cs— EF Core spans.src/Sentry.EntityFramework/SentryCommandInterceptor.cs:52-65,SentryQueryPerformanceListener.cs— EF6 breadcrumbs/spans.
What the category covers (spec 0.6.0 / 0.7.0, clarified)
The spec is now precise about the boundary, which answers the open question this issue originally carried ("decide whether false means dropping the statement or parameterized-statement-only"):
Gated by DatabaseQueryData:
- bound query parameters
- data payloads for write operations
- returned result data
Never gated — always collected:
- the sanitized/parameterized statement (
db.query.text) - structural metadata: database system, query summary, operation name, the table being acted upon
So DatabaseQueryData = false must not drop the statement. The real work for .NET is that we currently attach raw, unsanitized CommandText as the span description, which conflates the two: a raw statement with inlined literals is query data. Options:
- Sanitize/parameterize
CommandTextbefore attaching it (correct per spec, but needs a sanitizer we do not have), or - Treat raw
CommandTextas gated data underDatabaseQueryDatauntil a sanitizer exists, and document the gap.
Option 2 is the pragmatic first step and matches how sentry-java scoped its own rollout (it shipped databaseQueryData while documenting that OpenTelemetry-derived data is not yet controlled). Worth a maintainer decision before implementing.
Also note db.query.text is the current convention name — check what SentrySqlListener emits today.
JS analogue: #22219 — Supabase was first gated on userInfo and had to be re-gated on databaseQueryData. Getting the category right the first time matters.
Activity
linear-code commentedon Jul 22, 2026
NET-768
ref: drop the DataCollection categories nothing in .NET reads yet
jamescrosswell commentedon Nov 4, 2026
Decision: take option 2 — gate the raw
CommandTextThis came up in #5853, which adds
DataCollectionOptions. In review, @ric-oliv proposed dropping every category with no consumer in .NET yet,DatabaseQueryDataamong them, so this issue's open question had to be settled to decide whether the property ships at all.DatabaseQueryDatastays in the options, and this issue takes option 2: treat the rawCommandTextas data gated byDatabaseQueryDatauntil a sanitizer exists, and document the gap.The reasoning, for whoever picks this up:
src/captures DB parameters or result data. Searched forDbParameter,.ParametersandParameterCollection: no hits outside the Android bindings.CommandTextas the span description (SentrySqlListener.cs:213, the EF Core helpers,SentryCommandInterceptor,SentryQueryPerformanceListener), and a statement with inlined literals is query data. The exposure is real today even though the spec-literal consumer is not.Two notes for implementation:
DatabaseQueryData = falsecurrently drops more than the spec intends — the statement goes with the data. That trade-off needs documenting on the option itself, not just here.For context on the sibling issues:
Mcp,Queues,FilePaths,StackFrameVariablesandFrameContextLineswere removed fromDataCollectionOptionsin the same review, as none of them has a consumer or a planned one. This issue is unaffected, but the deferred-category list in #5420 should reflect them.feat: add experimental DataCollection options, successor to SendDefau…
fix: keep SQL statements on database spans regardless of DatabaseQuer…
ref: remove the experimental DataCollectionOptions.DatabaseQueryData …