Skip to content

feat!: remove Extra members from spans and transactions - #5589

Draft
jamescrosswell wants to merge 1 commit into
version7from
ref/remove-obsolete-extra
Draft

jamescrosswell wants to merge 1 commit into
version7from
ref/remove-obsolete-extra

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Warning

Don't merge - need to work out what to do with Scopes and Events first... interrogating colleagues to try to work this out.

Removes Extra/SetExtra from SentrySpan, SentryTransaction, TransactionTracer, SpanTracer (and NoOpSpan). These were aliases over the same store as Data.

To get there, ISpanData and IEventLike no longer inherit IHasExtra, which also drops it from ISpan, ITransactionData and ITransactionTracer. Internal callers (HTTP/GraphQL handlers, ASP.NET Core middleware, EF/SQL listeners, OpenTelemetry span processor) now use Data/SetData.

Open questions for review

  • Scope and SentryEvent still implement IHasExtra (now declared directly), with no Data. An event's extra is a separate protocol field from span/trace data, and it was never marked obsolete, so this PR leaves it alone. The result is a bit lopsided: IEventLike no longer exposes extras at all. Worth deciding whether that's the shape we want for v7, or whether this should wait for Attributes (as the issue suggests) and land with an analyzer/code fix.
  • Scope.Apply(IEventLike) now type-switches: IHasExtra targets get extras as before, IHasData targets (transactions) get them as Data. That preserves today's behaviour of scope extras ending up in trace data, but it's the ugliest part of the change. Dropping the IHasData branch would stop scope extras reaching transactions.

Closes #4640

🤖 Generated with Claude Code

ISpanData and IEventLike no longer inherit IHasExtra. Scope and SentryEvent
implement it directly. Scope.Apply copies scope extras into Data for
transactions, preserving previous behaviour.

Closes #4640

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

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (version7@8d4f28b). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             version7    #5589   +/-   ##
===========================================
  Coverage            ?   74.74%           
===========================================
  Files               ?      515           
  Lines               ?    18893           
  Branches            ?     3689           
===========================================
  Hits                ?    14122           
  Misses              ?     3891           
  Partials            ?      880           

☔ 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.

Comment thread src/Sentry/Scope.cs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit ugly now... note the two separate cases that have to be considered now:

  1. case IHasExtra hasExtra
  2. case IHasData hasData

Reason

Spans and transactions: all have IHasData now... including ISpan, ISpanData, ITransactionData, ITransactionTracer, SentrySpan, SentryTransaction, SpanTracer and TransactionTracer... and IEventLike itself has IHasExtra Thos types already had IHasData before this change. Their Extra was only an alias that read and wrote the same store as Data, so removing there is trivial.

Scope and SentryEvent: still IHasExtra, no Data.

Solutions

Ultimately we should be removing Extras from the Scope and SentryEvent as well. These should be replaced by Scope.Attributes and I assume Event.Attributes but I can't find any mention of Event.Attributes in the developer docs 😕

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.

1 participant