Skip to content

Commit 0947fb0

Browse files
author
Luca Forstner
committed
sad
1 parent 22a7b86 commit 0947fb0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/opentelemetry-node/src/spanprocessor.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
4040

4141
// If event has already set `trace` context, use that one.
4242
event.contexts = {
43+
...event.contexts,
4344
trace: {
45+
...event.contexts?.trace,
46+
// We are overriding values here. In theory this is bad and we definitely need to change that in the future.
47+
// The reason we need to override here is because in the core sdk we apply span data to the trace context at the time of capturing, and apply the propagation context if there is no span on the scope.
48+
// In the OTEL SDK we never have a span on the scope, meaning that the propagation context is applied.
49+
// If we now didn't overwrite the trace context here we would end up with the values of the propagation context instead but we want the data from the span.
4450
trace_id: otelSpanContext.traceId,
4551
span_id: otelSpanContext.spanId,
4652
parent_span_id: otelSpan.parentSpanId,
4753
},
48-
...event.contexts,
4954
};
5055

5156
return event;

0 commit comments

Comments
 (0)