DataCollection: capture database query parameters and reintroduce DatabaseQueryData
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reviewing the DataCollectionOptions.DatabaseQueryData removal in #5933, the DataCollectionResolver fallback, and the three integration entry points named here: SentrySqlListener, EFCommandDiagnosticSourceHelper, and SentryQueryPerformanceListener. Run or inspect each integration's tests, then add coverage for the option on, off, and not configured. Done means bounded parameter attributes are collected only when enabled, with parameter values absent from descriptions and db.query.text.
Written by the indexing model from the issue text.
Description
Part of #5420.
#5933 removed DataCollectionOptions.DatabaseQueryData, because nothing in .NET collects the data it controls. This issue brings it back, in the same PR as the first integration that collects that data.
What the option controls
The data collection spec scopes databaseQueryData to:
- bound query parameters
- payloads for write operations
- returned result data
Query statements (db.query.text) and structural metadata are outside it, and are collected regardless.
Proposal
Capture bound parameter values on database spans as db.query.parameter.<key> attributes, and gate them on DatabaseQueryData. All three database integrations can already reach the parameters:
- SqlClient (
SentrySqlListener): theCommandobject on the after-execute diagnostic event. Today we only readCommand.CommandTextfrom it. - EF Core (
EFCommandDiagnosticSourceHelper):CommandEventData.Command. - EF6 (
SentryQueryPerformanceListener): theDbCommandpassed to the interceptor.
Requirements:
- Apps that don't call
ConfigureDataCollectionsee no change. No parameter values are collected today, so the resolver's fallback must keep them off. - Parameter values never go into the span description or
db.query.text. - Values are bounded. Limit size and count, and handle null, binary and large values. When a value can't be handled safely, leave it out.
- Tests cover each integration with the option on, off and not configured.
Restoring the option
#5933 removed the option in a single commit on main, f08b02c59. Start with git revert f08b02c59, which restores:
- the property and its XML docs
- its
BindableSentryOptionsentry - the
DataCollectionResolveraccessor - their tests and the API approval snapshots
The restored accessor falls back to SendDefaultPii, which breaks the first requirement above. Change that fallback as part of this work.
The restored <remarks> also needs rewording. It says sanitized query statements, the query summary and the table are always collected, but .NET sends the raw CommandText and collects neither the summary nor the table.
Prior art
- sentry-python already does this.
record_sql_queriesattachesdb.paramsonly whendatabase_query_datais on. It also gates MongoDB values, Redis arguments, and ClickHouse parameters and results. - sentry-java plans the same thing for its next major version in getsentry/sentry-java#6021: JDBC bind values, and Android SQLite bind arguments.
#5933's description has the full comparison with sentry-python, sentry-java and sentry-go.
- Dominant language
- C#
- Stars
- 775
- Forks
- 262
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 118
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS samplePossibly taken A pull request linked to this issue is open or already merged. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6071 · 1 comment ·
Maintainers usually reply within 1 day
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Possibly taken @pcbeingused33 claimed this today. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6039 · 3 comments ·
Maintainers usually reply within 1 day
-
.NET Platform: Android Task
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
getsentry/sentry-dotnet#6020 · 3 comments ·
Maintainers usually reply within 1 day
-
Move the Blazor WebAssembly sample off the deprecated DevServerPossibly taken A pull request linked to this issue is open or already merged. Open.NET Framework: Blazor
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
getsentry/sentry-dotnet#5906 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Docs MSBuild Needs Docs Update
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getsentry/sentry-dotnet#5691 · 1 comment ·
Maintainers usually reply within 1 day
All issues in getsentry/sentry-dotnet
Similar issues
-
In-car displays show 0 km/h and P while the AV drivesPossibly taken @bazilinskyy claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bazilinskyy/coupled-sim#366 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BaryoDev/umbraco-pwa#196 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/fluentui-blazor#5688 ·
Maintainers usually reply within 1 day
-
bug flaky lsp-transport small
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day