Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #888 +/- ##
==========================================
- Coverage 82.85% 82.82% -0.03%
==========================================
Files 55 55
Lines 4619 4623 +4
==========================================
+ Hits 3827 3829 +2
- Misses 636 637 +1
- Partials 156 157 +1 ☔ View full report in Codecov by Sentry. |
|
@cleptric This fix is a partially functional solution that fixes the trace context only for transactions. It does not resolve the tracing information for events such as messages, exceptions, or any other attributes related to scope behavior (like breadcrumbs, etc.) based on the starting span setting here https://github.com/getsentry/sentry-go/blob/master/tracing.go#L197-L198. Here is an example of how the following code behaves: // Start the parent transaction
ctx := context.Background()
parentTransaction := sentry.StartTransaction(ctx, "parent-transaction")
// Start the parent transaction span
parentSpan := sentry.StartSpan(parentTransaction.Context(), "parent-span")
parentChildSpan := sentry.StartSpan(parentSpan.Context(), "parent-child-span")
// Capture message that should be attached to "parent-child-span"
sentry.CaptureMessage("Parent child span")
// Finish the "parent-child-span"
parentChildSpan.Finish()
// Capture message that should be attached to "parent-span", but will be attached to the "parent-child-span"
sentry.CaptureMessage("Parent span")
// Finish the "parent span"
parentSpan.Finish()
// Capture message that should be attached to "parent-transaction", but will be attached to the "parent-child-span"
sentry.CaptureMessage("Parent transaction completed")
parentTransaction.Finish()On the right side is the code running with PR #886, and on the left side is the code running with the current PR #888. 2024-10-08.09.41.04.mov |
Fixes #884
We mistakenly used the scope's span
tracecontext as thetracecontext for the transaction. Instead, we now set thetracecontext on the event when the transaction finishes and only use the scope's spantracecontext in case there is notracecontext on the event already.