fix(logs): Structured Logs do not send ParentSpanId when no Span was active#4565
Merged
fix(logs): Structured Logs do not send ParentSpanId when no Span was active#4565
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4565 +/- ##
=======================================
Coverage 73.47% 73.48%
=======================================
Files 482 482
Lines 17679 17678 -1
Branches 3495 3493 -2
=======================================
+ Hits 12989 12990 +1
Misses 3799 3799
+ Partials 891 889 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
@sentry review |
Member
alexsohn1126
left a comment
There was a problem hiding this comment.
A couple of possibly dumb questions 😛
e9c3cbd to
5b42cad
Compare
alexsohn1126
approved these changes
Oct 1, 2025
This was referenced Oct 2, 2025
This was referenced Oct 6, 2025
alexsohn1126
pushed a commit
that referenced
this pull request
Oct 11, 2025
This was referenced Oct 20, 2025
This was referenced Oct 28, 2025
This was referenced Nov 18, 2025
This was referenced Dec 8, 2025
This was referenced Dec 15, 2025
This was referenced Jan 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up PR
from #4462 (comment)
that is applying a change we made for the
Serilogintegration of Structured Logsto the SDK-Logger and the
Microsoft.Extensions.Loggingintegration,when reading values for the attributes
"trace_id"and"sentry.trace.parent_span_id".Rather than using the
TraceHeader,instead use the currently active Span, or the Propagation Context as a fallback.
During testing I noticed, that there doesn't seem to be a behavioral difference in Sentry, hence the#skip-changelog.Note
Structured Logs now derive
trace_idfrom the active span or scope and only includesentry.trace.parent_span_idwhen an active span exists.trace_id/parent_span_idviaSentryLog.GetTraceIdAndSpanId(...)from the activeSpan; fall back to scope fortrace_idonly.sentry.trace.parent_span_idwhen no active span.Sentry.Extensions.Logginglogger andDefaultSentryStructuredLoggernow use the new helper (replacingGetTraceHeader).Sentry.Serilogsink uses the helper; removes its local resolver.SentryLogcore type.parent_span_idwithout an active span.Written by Cursor Bugbot for commit 2326d97. This will update automatically on new commits. Configure here.