Skip to content

Commit 5feffb5

Browse files
author
Luca Forstner
committed
ugh
1 parent 3041f8e commit 5feffb5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/opentelemetry/src/setupEventContextTrace.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@ export function setupEventContextTrace(client: Client): void {
1919

2020
// If event has already set `trace` context, use that one.
2121
event.contexts = {
22+
...event.contexts,
2223
trace: {
24+
...event.contexts?.trace,
25+
// We are overriding values here. In theory this is bad and we definitely need to change that in the future.
26+
// 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.
27+
// In the OTEL SDK we never have a span on the scope, meaning that the propagation context is applied.
28+
// 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.
2329
trace_id: spanContext.traceId,
2430
span_id: spanContext.spanId,
2531
parent_span_id: spanHasParentId(span) ? span.parentSpanId : undefined,
2632
},
27-
...event.contexts,
2833
};
2934

3035
return event;

0 commit comments

Comments
 (0)