Skip to content

feat: DataCollection.UserInfo now gates the ASP.NET Core user in the OpenTelemetry integration - #5959

Closed
jamescrosswell wants to merge 2 commits into
mainfrom
ai/dc-5435-otel-logging-ad9dcf
Closed

jamescrosswell wants to merge 2 commits into
mainfrom
ai/dc-5435-otel-logging-ad9dcf

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

The OpenTelemetry integration now decides whether to put the ASP.NET Core user on the scope from the UserInfo data collection setting instead of SendDefaultPii. AspNetCoreEnricher reads DataCollectionResolver.UserInfo before it calls ISentryUserFactory.

Part of #5420 (Phase 2).

Closes #5435

Note

Sentry.OpenTelemetry is now deprecated anyway (we advise people to use Sentry.OpenTelemetry.Exporter instead)... It will likely be removed from the Sentry SDK for .NET in the same release that the Data Collection options become the default. So we probably don't need to invest too heavily in this area.

Behaviour

  • DataCollection not configured: unchanged. UserInfo bridges to SendDefaultPii.
  • ConfigureDataCollection(...) called: UserInfo decides, and SendDefaultPii is ignored. This only affects apps that opted in to the experimental option.

Notes for review

  • The logging packages have nothing to migrate. git grep -i pii finds nothing in Sentry.Serilog, Sentry.NLog, Sentry.Log4Net or Sentry.Extensions.Logging. The sendDefaultPii sink parameter the issue mentions went away in feat(serilog)!: the Sentry sink no longer initializes the SDK #5573, when the Serilog sink stopped initializing the SDK.
  • NLog's User layouts stay ungated. The app configures them, so the spec treats them as user-set data. A new integration test runs the real pipeline with UserInfo = false and checks that the event still has the layout's id, username, email and IP address.
  • db.statement / db.query.text stay ungated, as the issue says. SentrySpanProcessor is unchanged.
  • OTel span attributes still follow the defaults, not DataCollection. SentrySpanProcessor copies every Activity tag into span data or the otel context:

🤖 Generated with Claude Code

AspNetCoreEnricher reads DataCollectionResolver.UserInfo instead of
SendDefaultPii before setting the user from ISentryUserFactory. Without
ConfigureDataCollection, UserInfo bridges to SendDefaultPii, so nothing
changes for apps that don't opt in.

Adds an NLog integration test showing that User layouts, which the app
configures explicitly, are still sent with UserInfo = false.

Part of #5420
Closes #5435

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.71%. Comparing base (04c1c8d) to head (77ac5b8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5959   +/-   ##
=======================================
  Coverage   77.70%   77.71%           
=======================================
  Files         535      535           
  Lines       19731    19731           
  Branches     3934     3934           
=======================================
+ Hits        15332    15333    +1     
  Misses       3544     3544           
+ Partials      855      854    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Without options the enricher must not collect the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jamescrosswell

Copy link
Copy Markdown
Collaborator Author

Closing: Sentry.OpenTelemetry is deprecated in favour of Sentry.OpenTelemetry.Exporter, so it won't be moved onto the DataCollection options. #5967 documents that in the XML docs instead.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataCollection phase 2: migrate OpenTelemetry and logging integrations

1 participant