Skip to content

Commit ce944b1

Browse files
author
Luca Forstner
committed
hmm
1 parent fbcdded commit ce944b1

File tree

12 files changed

+12
-44
lines changed

12 files changed

+12
-44
lines changed

dev-packages/browser-integration-tests/suites/replay/captureReplay/test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
4141
replay_type: 'session',
4242
event_id: expect.stringMatching(/\w{32}/),
4343
environment: 'production',
44-
contexts: expect.any(Object),
4544
sdk: {
4645
integrations: [
4746
'InboundFilters',
@@ -79,7 +78,6 @@ sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalT
7978
replay_type: 'session',
8079
event_id: expect.stringMatching(/\w{32}/),
8180
environment: 'production',
82-
contexts: expect.any(Object),
8381
sdk: {
8482
integrations: [
8583
'InboundFilters',

dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ sentryTest('should capture replays (@sentry/replay export)', async ({ getLocalTe
4141
replay_type: 'session',
4242
event_id: expect.stringMatching(/\w{32}/),
4343
environment: 'production',
44-
contexts: expect.any(Object),
4544
sdk: {
4645
integrations: [
4746
'InboundFilters',

dev-packages/browser-integration-tests/utils/replayEventTemplates.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const DEFAULT_REPLAY_EVENT = {
1515
replay_type: 'session',
1616
event_id: expect.stringMatching(/\w{32}/),
1717
environment: 'production',
18-
contexts: expect.any(Object),
1918
sdk: {
2019
integrations: [
2120
'InboundFilters',

dev-packages/e2e-tests/test-applications/node-experimental-fastify-app/tests/propagation.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
6767
'sentry.origin': 'auto.http.otel.http',
6868
},
6969
op: 'http.server',
70-
parent_span_id: expect.any(String),
7170
span_id: expect.any(String),
7271
status: 'ok',
7372
tags: {

dev-packages/e2e-tests/test-applications/node-experimental-fastify-app/tests/transactions.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ test('Sends an API route transaction', async ({ baseURL }) => {
3232
'sentry.origin': 'auto.http.otel.http',
3333
},
3434
op: 'http.server',
35-
parent_span_id: expect.any(String),
3635
span_id: expect.any(String),
3736
status: 'ok',
3837
tags: {

packages/node/src/integrations/http.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type * as http from 'http';
22
import type * as https from 'https';
33
import type { Hub } from '@sentry/core';
44
import { getIsolationScope } from '@sentry/core';
5-
import { getRootSpan } from '@sentry/core';
65
import {
76
addBreadcrumb,
87
getActiveSpan,
@@ -270,21 +269,19 @@ function _createWrappedRequestMethodFactory(
270269
: undefined;
271270

272271
if (client && shouldAttachTraceData(rawRequestUrl)) {
273-
const transaction = requestSpan && getRootSpan(requestSpan);
274-
275272
const { traceId, spanId, sampled, dsc } = {
276273
...isolationScope.getPropagationContext(),
277274
...scope.getPropagationContext(),
278275
};
279276

280-
const sentryTraceHeader = transaction
281-
? spanToTraceHeader(transaction)
277+
const sentryTraceHeader = requestSpan
278+
? spanToTraceHeader(requestSpan)
282279
: generateSentryTraceHeader(traceId, spanId, sampled);
283280

284281
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(
285282
dsc ||
286-
(transaction
287-
? getDynamicSamplingContextFromSpan(transaction)
283+
(requestSpan
284+
? getDynamicSamplingContextFromSpan(requestSpan)
288285
: getDynamicSamplingContextFromClient(traceId, client, scope)),
289286
);
290287

packages/node/src/integrations/undici/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
getDynamicSamplingContextFromClient,
77
getDynamicSamplingContextFromSpan,
88
getIsolationScope,
9-
getRootSpan,
109
isSentryRequestUrl,
1110
spanToTraceHeader,
1211
} from '@sentry/core';
@@ -183,8 +182,6 @@ export class Undici implements Integration {
183182
};
184183

185184
if (shouldAttachTraceData(stringUrl)) {
186-
const transaction = span && getRootSpan(span);
187-
188185
const { traceId, spanId, sampled, dsc } = {
189186
...isolationScope.getPropagationContext(),
190187
...scope.getPropagationContext(),
@@ -194,8 +191,8 @@ export class Undici implements Integration {
194191

195192
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(
196193
dsc ||
197-
(transaction
198-
? getDynamicSamplingContextFromSpan(transaction)
194+
(span
195+
? getDynamicSamplingContextFromSpan(span)
199196
: getDynamicSamplingContextFromClient(traceId, client, scope)),
200197
);
201198

packages/opentelemetry-node/src/spanprocessor.ts

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

4141
// If event has already set `trace` context, use that one.
4242
event.contexts = {
43-
...event.contexts,
4443
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.
5044
trace_id: otelSpanContext.traceId,
5145
span_id: otelSpanContext.spanId,
5246
parent_span_id: otelSpan.parentSpanId,
5347
},
48+
...event.contexts,
5449
};
5550

5651
return event;

packages/opentelemetry/src/setupEventContextTrace.ts

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

2020
// If event has already set `trace` context, use that one.
2121
event.contexts = {
22-
...event.contexts,
2322
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.
2923
trace_id: spanContext.traceId,
3024
span_id: spanContext.spanId,
3125
parent_span_id: spanHasParentId(span) ? span.parentSpanId : undefined,
3226
},
27+
...event.contexts,
3328
};
3429

3530
return event;

packages/opentelemetry/test/integration/scope.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('Integration | Scope', () => {
151151
withScope(scope2 => {
152152
scope2.setTag('tag3', 'val3a');
153153

154-
startSpan({ name: 'first' }, span => {
154+
startSpan({ name: 'outer' }, span => {
155155
spanId1 = span.spanContext().spanId;
156156
traceId1 = span.spanContext().traceId;
157157

@@ -168,7 +168,7 @@ describe('Integration | Scope', () => {
168168
withScope(scope2 => {
169169
scope2.setTag('tag3', 'val3b');
170170

171-
startSpan({ name: 'second' }, span => {
171+
startSpan({ name: 'outer' }, span => {
172172
spanId2 = span.spanContext().spanId;
173173
traceId2 = span.spanContext().traceId;
174174

packages/tracing-internal/src/browser/request.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
getDynamicSamplingContextFromClient,
66
getDynamicSamplingContextFromSpan,
77
getIsolationScope,
8-
getRootSpan,
98
hasTracingEnabled,
109
spanToJSON,
1110
spanToTraceHeader,
@@ -299,8 +298,6 @@ export function xhrCallback(
299298
const client = getClient();
300299

301300
if (xhr.setRequestHeader && shouldAttachHeaders(sentryXhrData.url) && client) {
302-
const transaction = span && getRootSpan(span);
303-
304301
const { traceId, spanId, sampled, dsc } = {
305302
...isolationScope.getPropagationContext(),
306303
...scope.getPropagationContext(),
@@ -310,9 +307,7 @@ export function xhrCallback(
310307

311308
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(
312309
dsc ||
313-
(transaction
314-
? getDynamicSamplingContextFromSpan(transaction)
315-
: getDynamicSamplingContextFromClient(traceId, client, scope)),
310+
(span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromClient(traceId, client, scope)),
316311
);
317312

318313
setHeaderOnXhr(xhr, sentryTraceHeader, sentryBaggageHeader);

packages/tracing-internal/src/common/fetch.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
getDynamicSamplingContextFromClient,
55
getDynamicSamplingContextFromSpan,
66
getIsolationScope,
7-
getRootSpan,
87
hasTracingEnabled,
98
spanToTraceHeader,
109
startInactiveSpan,
@@ -133,8 +132,6 @@ export function addTracingHeadersToFetchRequest(
133132
// eslint-disable-next-line deprecation/deprecation
134133
const span = requestSpan || scope.getSpan();
135134

136-
const transaction = span && getRootSpan(span);
137-
138135
const isolationScope = getIsolationScope();
139136

140137
const { traceId, spanId, sampled, dsc } = {
@@ -146,9 +143,7 @@ export function addTracingHeadersToFetchRequest(
146143

147144
const sentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader(
148145
dsc ||
149-
(transaction
150-
? getDynamicSamplingContextFromSpan(transaction)
151-
: getDynamicSamplingContextFromClient(traceId, client, scope)),
146+
(span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromClient(traceId, client, scope)),
152147
);
153148

154149
const headers =

0 commit comments

Comments
 (0)