Skip to content

Commit ef2834d

Browse files
author
Luca Forstner
committed
revert
1 parent 54bf214 commit ef2834d

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

packages/core/src/baseclient.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,17 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
642642
...(scope ? scope.getPropagationContext() : undefined),
643643
};
644644

645-
if (propagationContext && (!evt.sdkProcessingMetadata || !evt.sdkProcessingMetadata.dynamicSamplingContext)) {
646-
const { traceId: trace_id, dsc } = propagationContext;
645+
const trace = evt.contexts && evt.contexts.trace;
646+
if (!trace && propagationContext) {
647+
const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;
648+
evt.contexts = {
649+
trace: {
650+
trace_id,
651+
span_id: spanId,
652+
parent_span_id: parentSpanId,
653+
},
654+
...evt.contexts,
655+
};
647656

648657
const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);
649658

packages/core/src/utils/applyScopeDataToEvent.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Breadcrumb, Event, PropagationContext, ScopeData, Span } from '@sentry/types';
1+
import type { Breadcrumb, Event, ScopeData, Span } from '@sentry/types';
22
import { arrayify, dropUndefinedKeys } from '@sentry/utils';
33
import { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext';
44
import { getRootSpan } from './getRootSpan';
@@ -8,19 +8,16 @@ import { spanToJSON, spanToTraceContext } from './spanUtils';
88
* Applies data from the scope to the event and runs all event processors on it.
99
*/
1010
export function applyScopeDataToEvent(event: Event, data: ScopeData): void {
11-
const { fingerprint, span, breadcrumbs, sdkProcessingMetadata, propagationContext } = data;
11+
const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data;
1212

1313
// Apply general data
1414
applyDataToEvent(event, data);
1515

1616
// We want to set the trace context for normal events only if there isn't already
1717
// a trace context on the event. There is a product feature in place where we link
1818
// errors with transaction and it relies on that.
19-
// If there is a span, we use that to apply the trace data, if not, we use the propagation context as a fallback.
2019
if (span) {
2120
applySpanToEvent(event, span);
22-
} else {
23-
applyPropagationContextToEvent(event, propagationContext);
2421
}
2522

2623
applyFingerprintToEvent(event, fingerprint);
@@ -188,16 +185,6 @@ function applySpanToEvent(event: Event, span: Span): void {
188185
}
189186
}
190187

191-
function applyPropagationContextToEvent(event: Event, propagationContext: PropagationContext): void {
192-
event.contexts = {
193-
trace: {
194-
trace_id: propagationContext.traceId,
195-
span_id: propagationContext.spanId,
196-
},
197-
...event.contexts,
198-
};
199-
}
200-
201188
/**
202189
* Applies fingerprint from the scope to the event if there's one,
203190
* uses message if there's one instead or get rid of empty fingerprint

0 commit comments

Comments
 (0)