Skip to content

DataCollection phase 3: deprecate SendDefaultPii #5437

Open

Description

@jamescrosswell

Part of #5420. Phase 3 — deprecation.

Deprecate SentryOptions.SendDefaultPii (src/Sentry/SentryOptions.cs:333):

  • Changelog + doc-comment deprecation with the DataCollection migration snippet that comes closest to SendDefaultPii = false (see the callout below).
  • Semantics: SendDefaultPii = true ≈ new defaults; if both options are set, SendDefaultPii is ignored.

Release-note callout (moved from #5438)

The spec defaults are already live for anyone who calls ConfigureDataCollection (#5853, #5885), so the deprecation's migration note has to warn that ConfigureDataCollection(_ => { }) collects more than SendDefaultPii = false: user info, cookies, GraphQL documents and variables, and the headers and URL fragment on HTTP client failed-request events are all on.

The snippet can only approximate SendDefaultPii = false, so the note should name what differs:

  • UserInfo = false, Cookies = KeyValueCollectionBehavior.Off and GraphQL.Document/.Variables = false match it.
  • Headers can't match. SendDefaultPii = false collects request headers server-side (deny list) but sends none on failed-request events, while HttpHeaders.Request sets both at once. The URL fragment on failed-request events has the same split with UrlQueryParams.
  • Opting in sanitizes database statements, and nothing turns that off.
  • HttpBodies only gates incoming request bodies today, still bounded by MaxRequestBodySize. Nothing reads the other three directions.

Open question: [Experimental]

ConfigureDataCollection and DataCollectionOptions are still [Experimental]. Deprecating SendDefaultPii in favour of an experimental API sends a mixed message under either option below, so decide here whether the attribute comes off as part of this issue.

How other SDKs played it

The three reference SDKs diverge, so this is a genuine choice rather than a convention to copy:

SDK Posture
JavaScript Deprecated in 10.57.0 (JSDoc only, no runtime warning), removed in v11
Java Deprecated with an explicit "will be removed in the next major (v9)" alert in the docs
Python Explicitly not deprecating yet — "that won't happen until a future major version. Until then, send_default_pii remains fully supported"

Decision needed: [Obsolete] on main, or signpost only

[Obsolete] produces compiler warnings that break consumers building with TreatWarningsAsErrors — a cost JSDoc @deprecated does not have. And this repo has a relevant precedent: #5629 marked three options [Obsolete] on main ahead of a 7.0.0 change and was closed, the convention being that a "do X in the next major" conclusion is implemented as X itself on the version7 branch rather than substituted with an [Obsolete] on main.

That precedent is not a perfect match — here the spec roadmap has a real deprecation phase, so an [Obsolete] would be signposting rather than a substitute for the removal (which #5439 does on version7). Still, it needs maintainer buy-in before landing. Options:

  1. Docs/changelog deprecation only on main (XML doc comment + the migration snippet), removal on version7 via DataCollection phase 5: remove SendDefaultPii (next major) #5439. Closest to the feat: SentryOptions.ScopeObserver, EnableScopeSync and CrashedLastRun are obsolete #5629 convention and to Python's posture.
  2. [Obsolete] on main with a clear message pointing at DataCollection, removal on version7. Matches JS/Java, at the cost of consumer build warnings.

The Phase 2 migrations are all closed, so this is no longer blocked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETFeature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions