Skip to content

Commit 2935759

Browse files
committed
fix
1 parent 34985ce commit 2935759

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/opentelemetry-node/src/spanprocessor.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
8787

8888
if (this._strictSpanParentHandling && !!otelParentSpanId && !sentryParentSpan) {
8989
logger.warn(
90-
`SentrySpanProcessor could not find parent span with OTEL-spanId ${otelParentSpanId}. Dropping the span with OTEL-spanID ${otelSpanId}...`,
90+
`SentrySpanProcessor could not find parent span with OTEL-spanId ${otelParentSpanId}. Dropping the span "${otelSpan.name}" with OTEL-spanID ${otelSpanId}...`,
9191
);
9292
return;
9393
}
@@ -112,6 +112,10 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
112112
});
113113

114114
SENTRY_SPAN_PROCESSOR_MAP.set(otelSpanId, transaction);
115+
116+
if (this._strictSpanParentHandling) {
117+
SCHEDULE_TO_CLEAR.set(transaction.spanId, []);
118+
}
115119
}
116120
}
117121

@@ -327,7 +331,7 @@ function scheduleToClear(otelSpanId: string): void {
327331
const root = span.transaction;
328332
const rootSentrySpanId = root.spanId;
329333

330-
const toClear = SCHEDULE_TO_CLEAR.get(root.spanId);
334+
const toClear = SCHEDULE_TO_CLEAR.get(rootSentrySpanId);
331335

332336
// If this does not exist, it means we prob. already cleaned it up before
333337
// So we ignore the parent and just clean this span up right now
@@ -337,10 +341,6 @@ function scheduleToClear(otelSpanId: string): void {
337341
}
338342

339343
toClear.push(otelSpanId);
340-
341-
if (!SCHEDULE_TO_CLEAR.has(rootSentrySpanId)) {
342-
SCHEDULE_TO_CLEAR.set(rootSentrySpanId, toClear);
343-
}
344344
}
345345

346346
function spanIsRoot(span: SentrySpan): span is Transaction {

0 commit comments

Comments
 (0)