feat!: remove Extra members from spans and transactions - #5589
jamescrosswell wants to merge 1 commit into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
This is a bit ugly now... note the two separate cases that have to be considered now:
case IHasExtra hasExtracase 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 😕
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/SetExtrafromSentrySpan,SentryTransaction,TransactionTracer,SpanTracer(andNoOpSpan). These were aliases over the same store asData.To get there,
ISpanDataandIEventLikeno longer inheritIHasExtra, which also drops it fromISpan,ITransactionDataandITransactionTracer. Internal callers (HTTP/GraphQL handlers, ASP.NET Core middleware, EF/SQL listeners, OpenTelemetry span processor) now useData/SetData.Open questions for review
ScopeandSentryEventstill implementIHasExtra(now declared directly), with noData. An event'sextrais a separate protocol field from span/tracedata, and it was never marked obsolete, so this PR leaves it alone. The result is a bit lopsided:IEventLikeno 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:IHasExtratargets get extras as before,IHasDatatargets (transactions) get them asData. That preserves today's behaviour of scope extras ending up in trace data, but it's the ugliest part of the change. Dropping theIHasDatabranch would stop scope extras reaching transactions.Closes #4640
🤖 Generated with Claude Code