Repository navigation
Description
Overview
The DataCollection spec replaces the binary SendDefaultPii flag with a structured DataCollection option that gives users per-category control over automatically collected data:
UserInfo(id/email/username/ip) — defaulttrueCookies,HttpHeaders(request/response),UrlQueryParams— key-value collection behavior:off/denyList(default) /allowListover a canonical sensitive-terms denylist, values replaced with[Filtered]HttpBodies— which of the four directions (incoming/outgoing × request/response) to attachGraphQL(document/variables),GenAI(inputs/outputs),Mcp(inputs/outputs),DatabaseQueryData,Queues,FilePaths,StackFrameVariables(bool or key-value behavior),FrameContextLines
The .NET option ships a subset of these — see Deferred categories under .NET-specific notes.
Tracking spec version: 0.18.0 (status candidate). The spec carries spec_version / spec_changelog frontmatter in develop-docs/sdk/foundations/client/data-collection/index.mdx — check that version before picking up any issue here, and bump this line when re-syncing.
Reference implementations
Primary: sentry-java (availableSince 8.58.0) — the closest analogue to .NET (strongly typed, mutable options object, external config binding). Key sources: io.sentry.DataCollection, io.sentry.DataCollectionResolver, io.sentry.KeyValueCollectionBehavior. It models the behavior as an OFF/DENY_LIST/ALLOW_LIST mode plus terms, exposes forceDataCollection() as an explicit opt-in, splits mode/terms for properties-based config, and deliberately shipped a subset of categories with the gaps documented.
Also shipped: sentry-javascript (removed sendDefaultPii in v11; unset dataCollection now collects everything), sentry-cocoa (9.22.0), sentry-php, sentry-ruby, sentry-python (option added, send_default_pii explicitly not deprecated yet).
JS rollout history remains useful for sequencing: getsentry/sentry-javascript#20141, foundation PR #20965.
Strategy
- Single read path: all consumers read a resolved view of
DataCollection, neverSendDefaultPiidirectly. DataCollection phase 1: resolver and SendDefaultPii bridge #5426 settled this as lazy per call (sentry-java's model) rather than computed once at init (JS), sinceSentryOptionsstays mutable afterInitand a snapshot would ignore later edits by applications and tests alike. - Bridge: when
DataCollectionis not configured, each category keeps its legacy behaviour: derived fromSendDefaultPiiwhereSendDefaultPiigated it, otherwise unchanged (spec 0.16.0's migration rule). If both are set,SendDefaultPiiis ignored. The derivation is per category, not one global on/off, because whatSendDefaultPiigates today varies by call site:- DataCollection phase 1: resolver and SendDefaultPii bridge #5426 dropped the GDPR deny-terms the JS bridge adds for
SendDefaultPii = false: .NET has never filteredX-Forwarded-Forand friends, so adding them in the bridge would have made the Phase 2 header migration carry a behaviour change. Headers and query params therefore bridge to a plainDenyList()and cookies toOff, matching what sentry-java's resolver does; the terms stay available as a deliberate change in DataCollection phase 0: always redact sensitive header values #5422. - Those plain deny lists are faithful to the server-side capture path, where
SendDefaultPii = falseskips only theCookieheader and collects every other header and the query string regardless. The client-side failed-request handlers are all-or-nothing instead, so DataCollection phase 2: migrate redact cascade and HTTP failed-request handler #5429 and DataCollection phase 2: migrate GraphQL instrumentation #5432 each need per-call-site legacy-gate accessors (…WithLegacyPiiGate) for headers and the URL, as sentry-java does withisGraphqlDocumentWithLegacyBodyGate(). IncomingRequestBodybridges totrue, notSendDefaultPii:MaxRequestBodySizehas always been its only gate, so followingSendDefaultPiiwould have cost DataCollection phase 2: migrate Sentry.AspNetCore #5430 the request bodies of every app that set a size without setting PII.GenAI.Inputs/GenAI.Outputsbridge totrue.SendDefaultPiinever gated AI content, and spec 0.16.0 says an SDK must not derive a category fromSendDefaultPiiwhen it can't map it cleanly, so apps that don't opt in keep sending it (feat: DataCollection.GenAI now gates AI prompts, completions, tool definitions, tool calls and tool results #5931).
- DataCollection phase 1: resolver and SendDefaultPii bridge #5426 dropped the GDPR deny-terms the JS bridge adds for
- New permissive defaults apply only when the user explicitly configures
DataCollection. feat: add experimental DataCollection options, successor to SendDefaultPii #5853 settled how that is detected:SentryOptions.DataCollectionis aninternal DataCollectionOptions?that staysnulluntil the user calls the publicConfigureDataCollection(Action<DataCollectionOptions>)— .NET's equivalent of Java'sforceDataCollection().DataCollectionOptionshas an internal constructor, so that callback is the only way in andnullis an unambiguous "not configured" signal for DataCollection phase 1: resolver and SendDefaultPii bridge #5426's bridge. Nobody's behavior changes until the next major. - User-set data is never gated (e.g. an explicitly set
User);DataCollectiononly gates automatic collection — it guards writing to the scope, not reading from it. - Integration-level options take precedence over the global
DataCollectionlayer (e.g.MaxRequestBodySize,SentryAIOptions.RecordInputs). - Session Replay is out of scope — the spec forbids gating Replay on
DataCollection(DataCollection: Session Replay must not be gated by DataCollection (spec 0.10.0) #5852). - Every PR is independently shippable and behavior-neutral. Phase 0 tightens default privacy with no new API and is useful standalone.
Dependency graph
These relationships are wired as native GitHub issue dependencies, so each issue shows its own blockers and GitHub greys out work that isn't ready. The diagram is the same information in one view.
There are two independent roots — #5421 (the filtering utility) and #5425 (the option types). Phase 0 and Phase 1 do not depend on each other, so both tracks can run from day one.
flowchart TD
subgraph P0["Phase 0 · hardening (no new API)"]
I5421["#5421 denylist + filter utility"]
I5422["#5422 header values"]
I5423["#5423 cookies"]
I5424["#5424 query params"]
end
subgraph P1["Phase 1 · foundation"]
I5425["#5425 option types"]
I5426["#5426 resolver + bridge"]
end
subgraph P2["Phase 2 · consumer migrations"]
I5428["#5428 core enricher"]
I5429["#5429 redact + failed-request"]
I5430["#5430 AspNetCore"]
I5431["#5431 AspNet / System.Web"]
I5432["#5432 GraphQL"]
I5433["#5433 database"]
I5434["#5434 Extensions.AI"]
I5435["#5435 OTel + logging"]
I5436["#5436 native Android/Cocoa"]
end
subgraph DOCS["Spec compliance"]
I5851["#5851 setup step"]
I5852["#5852 Replay exclusion"]
end
subgraph TAIL["Phases 3-5"]
I5437["#5437 deprecate"]
I5439["#5439 remove · version7"]
end
I5421 --> I5422 & I5423 & I5424
I5425 --> I5426 & I5851
I5426 --> I5428 & I5429 & I5430 & I5431 & I5432 & I5433 & I5434 & I5435 & I5436
I5422 & I5423 --> I5429 & I5432
I5422 & I5423 & I5424 --> I5430 & I5431
I5436 --> I5852
I5428 & I5429 & I5430 & I5431 & I5432 & I5433 & I5434 & I5435 & I5436 --> I5437
I5437 --> I5439
Edges come in two kinds, both wired as dependencies because both cause rework if ignored:
- Hard: the later issue cannot compile or has nothing to read without the earlier one — e.g. every Phase 2 issue needs
#5426's resolver;#5426needs#5425's types. - Sequencing: the later issue rewrites the very call sites the earlier one hardened.
#5430/#5431revisit the same ASP.NET scope-extension code that#5422,#5423and#5424touch, and#5429/#5432share the failed-request handlers with#5422/#5423. Doing these out of order means writing the same lines twice and resolving avoidable conflicts.
Execution order
| Wave | Issues | Notes |
|---|---|---|
| 1 | #5425#5421 |
Two independent roots. #5425 shipped in #5853; #5421 is in review (PR #5440) |
| 2 | #5422 → #5423 → #5424 · #5426 + #5851 |
Phase 0 trio all share the ASP.NET capture sites, so stack them in that order rather than running them concurrently. #5426 and #5851 are genuinely parallel, and both are unblocked now that #5425 has landed |
| 3 | #5428 · #5433 · #5434 · #5435 · #5436 |
Fully parallel — each touches a disjoint set of files (enricher, DiagnosticSource/EF, Extensions.AI, OTel/logging, Platforms+bindings). The widest point of the project |
| 4 | #5429 · #5432 · then #5430 · #5431 |
Need Phase 0 done as well as #5426. #5430/#5431 overlap each other least but both follow the Phase 0 trio |
| 5 | #5852 |
Once #5436's native mapping exists to test against |
| 6 | #5437 |
Needs all of Phase 2. #5438 was folded into it |
| 7 | #5439 |
version7 branch |
Critical path: #5425 → #5426 → (widest Phase 2 item) → #5437 → #5439. Note it runs through Phase 1, not Phase 0 — so with #5425 shipped, #5426 is now the highest-leverage thing to start, and Phase 0 is not on it at all.
Startable right now: #5426 and #5851, both unblocked by #5425 shipping. #5421 is in review (PR #5440); the rest of Phase 0 follows it.
Issues
Phase 0 — hardening pre-work (no new API, each independently useful)
- DataCollection phase 0: sensitive-terms denylist and key-value filtering utility #5421 sensitive-terms denylist + key-value filtering utility
- DataCollection phase 0: always redact sensitive header values #5422 always redact sensitive header values
- DataCollection phase 0: parse cookies individually and filter sensitive cookie names #5423 per-cookie parsing + sensitive cookie-name filtering
- DataCollection phase 0: scrub sensitive URL query parameters #5424 scrub sensitive URL query parameters
Phase 1 — foundation (option is a documented no-op after this)
- DataCollection phase 1: add option types (no-op) #5425 option types
- DataCollection phase 1: resolver and SendDefaultPii bridge #5426 resolver + SendDefaultPii bridge
Phase 2 — consumer migrations (behavior-neutral, one PR per area)
- DataCollection phase 2: migrate core enricher (UserInfo) #5428 core enricher (UserInfo)
- DataCollection phase 2: migrate redact cascade and HTTP failed-request handler #5429 redact cascade + HTTP failed-request handler
- DataCollection phase 2: migrate Sentry.AspNetCore #5430 Sentry.AspNetCore
- DataCollection phase 2: migrate Sentry.AspNet (System.Web) #5431 Sentry.AspNet (System.Web)
- DataCollection phase 2: migrate GraphQL instrumentation #5432 GraphQL instrumentation
- DataCollection phase 2: gate database query data #5433 database query data —
DatabaseQueryDataremoved in ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933; DataCollection: capture database query parameters and reintroduce DatabaseQueryData #5955 brings it back with parameter capture- ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933
- Statement sanitizing moved to Sanitize SQL statements before attaching them to database spans and breadcrumbs #5964 (feat: DataCollection now sanitizes SQL statements on SqlClient, EF Core and EF6 spans and breadcrumbs #5966, open)
- DataCollection phase 2: migrate Sentry.Extensions.AI (GenAI) #5434 Sentry.Extensions.AI (GenAI)
- feat: DataCollection.GenAI now gates AI prompts, completions, tool definitions, tool calls and tool results #5931
- Docs: docs(dotnet): Document GenAI data collection for AI Agents sentry-docs#20870 (open, ships with the release that includes feat: DataCollection.GenAI now gates AI prompts, completions, tool definitions, tool calls and tool results #5931)
- DataCollection phase 2: migrate OpenTelemetry and logging integrations #5435 OpenTelemetry + logging integrations — closed as not planned; the OTel gap is documented instead (feat: DataCollection.UserInfo now gates the ASP.NET Core user in the OpenTelemetry integration #5959 closed unmerged)
- DataCollection phase 2: propagate to native (Android/Cocoa) #5436 native propagation (Android/Cocoa)
- feat: DataCollection now configures the native Android SDK, and UserInfo the native Cocoa SDK #5960
- Cocoa forwards only
UserInfountil sentry-cocoa 10: Bump to sentry-cocoa 10 #5972
Spec compliance / docs
- DataCollection: Session Replay must not be gated by DataCollection (spec 0.10.0) #5852 Session Replay must not be gated by
DataCollection(spec 0.10.0) - DataCollection: present DataCollection as an explicit setup step (spec 0.12.0) #5851 present
DataCollectionas an explicit setup step (spec 0.12.0)
Phase 3 — deprecation
- DataCollection phase 3: deprecate SendDefaultPii #5437 deprecate
SendDefaultPii([Obsolete]-on-mainvs. signpost-only: decision needed)- DataCollection is no longer experimental at this point so the options will need to move in the same PR
Phase 4 — next major (version7 branch)
- DataCollection phase 5: remove SendDefaultPii (next major) #5439 remove
SendDefaultPii
.NET-specific notes
- The shipped option shape (feat: add experimental DataCollection options, successor to SendDefaultPii #5853).
UserInfo,Cookies,HttpHeaders.Request/.Response,HttpBodies,UrlQueryParams,GraphQL.Document/.Variables,GenAI.Inputs/.Outputs.DatabaseQueryDatashipped too, until ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933 removed it (see Deferred categories). Nested groups are get-only and configured in place.KeyValueCollectionBehavioris immutable, built viaOff/DenyList(...)/AllowList(...)with an implicitboolconversion, and strips null and empty terms in its constructor — an empty term would otherwise match every key. The object starts at spec defaults (every category collected, key-value categories onDenyList), so DataCollection phase 1: resolver and SendDefaultPii bridge #5426's bridge only has to choose between "DataCollectionisnull→ derive fromSendDefaultPii" and "non-null → use as-is". - Native propagation is unblocked. Both natives have shipped the option: sentry-java 8.58.0 (we pin Android 8.62.0) and sentry-cocoa 9.22.0 (we are on 9.3x). Our Cocoa bindings do not surface the
SentryObjCDataCollection*types yet — they are missing fromKeepInterfaces(...)inscripts/patch-cocoa-bindings.cs— so DataCollection phase 2: propagate to native (Android/Cocoa) #5436 is now real binding work rather than a conservative down-convert. - Config binding ships with the option that needs it, never as a separate step. CLAUDE.md treats adding a property to an options class and adding its
Bindable*counterpart as one procedure, and theBindableProperties_MatchOptionsPropertiestest enforces it. CoreDataCollectionbinding landed with the types in DataCollection phase 1: add option types (no-op) #5425; any platform-specific category added later (AspNetCore, Maui) carries its own bindable counterpart in the same PR.KeyValueCollectionBehaviorbinds through aMode/Termssurrogate, matching sentry-java'sdata-collection.cookies.mode/.terms.- Note for Maui:
SentryMauiOptionsSetupbinds theSentrysection from an injectedIConfiguration, but MAUI registers no file-based configuration provider by default, so nothing binds there unless the app embedsappsettings.jsonand wires it up itself. The bindable class still has to stay in parity because the harness enforces it.
- Note for Maui:
- Breaking changes go to
version7, notmain(precedent: feat:SentryOptions.ScopeObserver,EnableScopeSyncandCrashedLastRunare obsolete #5629, closed). DataCollection phase 5: remove SendDefaultPii (next major) #5439 targets that branch. - Deferred categories — deliberately not in the shipped option.
Mcp,Queues,FilePaths,StackFrameVariablesandFrameContextLineswere removed fromDataCollectionOptionsin feat: add experimental DataCollection options, successor to SendDefaultPii #5853, andDatabaseQueryDatain ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933. Each was checked for a consumer insrc/and had none: no MCP instrumentation; Hangfire/Quartz/Quartz3 are check-in integrations and do not read job arguments; no file-system instrumentation; and nothing in the SDK populatesSentryStackFrame.Vars,PreContext,PostContextorContextLine. The spec is stillcandidateand has renamed or retyped four options since June, so a public property for something we do not instrument locks in today's shape, whereas adding one later never breaks anyone. Add each back in the PR that first instruments its data, together with its bindable counterpart.DatabaseQueryDatawas first kept for DataCollection phase 2: gate database query data #5433 to gate the rawCommandText, then removed in ref: remove the experimental DataCollectionOptions.DatabaseQueryData until .NET collects query data #5933: the spec puts query statements outside the category, sentry-python, sentry-java and sentry-go all send the statement whatever it says, and .NET collects none of what it does cover (bound parameters, write payloads, results). DataCollection: capture database query parameters and reintroduce DatabaseQueryData #5955 brings it back with parameter capture.GenAIwas kept (Sentry.Extensions.AIalready emits the content under its ownRecordInputs/RecordOutputs, DataCollection phase 2: migrate Sentry.Extensions.AI (GenAI) #5434). JS addedgraphQL/databaseQueryDatalate and had to re-gate integrations (#22219) and renamequeryParams→urlQueryParams(#22217) — we use final spec names from the start. - Partial coverage with documented gaps is accepted practice — sentry-java shipped without
genAI/mcp/queues/stackFrameVariables/frameContextLinesand documented that OpenTelemetry-derived HTTP data and Logback unencoded messages still followsendDefaultPii.
Spec changes since this epic was filed (0.9.0 → 0.18.0)
| Version | Change | Issues updated |
|---|---|---|
| 0.18.0 | Define the installation identifier: userInfo must not gate it, and it must not come from values that identify the device outside the app, such as a MAC address or host name, even hashed |
Not gated by UserInfo in Enricher (correct). But InstallationIdHelper falls back to the MAC address and then a machine-name hash when it can't store a random ID (#5953). #5960's Cocoa mapping (sendDefaultPii = UserInfo) also gates Cocoa 9.x's installation-ID user on logs and metrics, for apps that opt in |
| 0.17.0 | Attach text bodies unchanged; SDKs no longer parse bodies to scrub them, and server-side scrubbing applies | No change: the request payload extractors never scrubbed bodies. #5430 / #5431 must not add body scrubbing |
| 0.16.0 | Migration from sendDefaultPii: an SDK that can't cleanly map it onto a category must not derive that category from it |
#5434 (GenAI bridges to true, #5931); #5433 (DatabaseQueryData removed, #5933) |
| 0.15.0 | Cookies attach as one string-array attribute (name=value elements); filter nameless cookie segments and unparseable cookie strings |
#5423 |
| 0.14.0 | Add mcp ({ inputs, outputs }, default true), separate from genAI |
Deferred — no MCP instrumentation (#5853) |
| 0.13.0 | Add filePaths (default true) |
Deferred — no file-I/O instrumentation (#5853) |
| 0.12.0 | dataCollection must be an explicit setup step, not a commented-out override |
#5851 (new) |
| 0.11.0 | Encoded URL query params stored exactly as they appear | #5424 |
| 0.10.0 | Session Replay not gated by dataCollection |
#5852 (new) |
| 0.9.1 | genAI.inputs also gates system instructions, tool definitions, tool call arguments |
#5434 |
| 0.9.0 | stackFrameVariables accepts a KeyValueCollectionBehavior as well as a bool |
Deferred — nothing populates frame vars (#5853) |
Activity
linear-code commentedon Jul 22, 2026
NET-755
2 remaining items
ref: Add internal sensitive-data denylist and key-value filter utility (
docs(dotnet): Document ConfigureDataCollection and add a data collect…