Skip to content

Support the new DataCollection option (successor to SendDefaultPii) #5420

Open
18 of 22 issues completed
Open

Description

@jamescrosswell

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) — default true
  • Cookies, HttpHeaders (request/response), UrlQueryParams — key-value collection behavior: off / denyList (default) / allowList over a canonical sensitive-terms denylist, values replaced with [Filtered]
  • HttpBodies — which of the four directions (incoming/outgoing × request/response) to attach
  • GraphQL (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, never SendDefaultPii directly. 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), since SentryOptions stays mutable after Init and a snapshot would ignore later edits by applications and tests alike.
  • Bridge: when DataCollection is not configured, each category keeps its legacy behaviour: derived from SendDefaultPii where SendDefaultPii gated it, otherwise unchanged (spec 0.16.0's migration rule). If both are set, SendDefaultPii is ignored. The derivation is per category, not one global on/off, because what SendDefaultPii gates today varies by call site:
  • 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.DataCollection is an internal DataCollectionOptions? that stays null until the user calls the public ConfigureDataCollection(Action<DataCollectionOptions>) — .NET's equivalent of Java's forceDataCollection(). DataCollectionOptions has an internal constructor, so that callback is the only way in and null is 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); DataCollection only gates automatic collection — it guards writing to the scope, not reading from it.
  • Integration-level options take precedence over the global DataCollection layer (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
Loading

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; #5426 needs #5425's types.
  • Sequencing: the later issue rewrites the very call sites the earlier one hardened. #5430 / #5431 revisit the same ASP.NET scope-extension code that #5422, #5423 and #5424 touch, and #5429 / #5432 share 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)

Phase 1 — foundation (option is a documented no-op after this)

Phase 2 — consumer migrations (behavior-neutral, one PR per area)

Spec compliance / docs

Phase 3 — deprecation

Phase 4 — next major (version7 branch)

.NET-specific notes

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)

Sub-issues

Sub-issues

18 of 22 Issues completed
Loading 22 sub-issues

Activity

  1. added
    Feature
    on Jul 22, 2026
  2. linear-code commented on Jul 22, 2026

    @linear-code
  3. added
    public API
    on Jul 22, 2026
  4. 2 remaining items

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

Metadata

Metadata

Labels

FeatureTracking Issuepublic API

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions