Skip to content

Commit 00ff5b5

Browse files
committed
fix(deno): Avoid inferring invalid span op from Deno tracer
1 parent 7c19325 commit 00ff5b5

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

dev-packages/e2e-tests/test-applications/deno/tests/ai.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('should create AI pipeline spans with Vercel AI SDK', async ({ baseURL }) =
3232
(span: any) =>
3333
span.op === 'gen_ai.invoke_agent' ||
3434
span.op === 'gen_ai.generate_content' ||
35-
span.op === 'otel.span' ||
35+
!span.op ||
3636
span.description?.includes('ai.generateText'),
3737
);
3838

dev-packages/e2e-tests/test-applications/deno/tests/transactions.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ test('Sends transaction with OTel tracer.startSpan despite pre-existing provider
3333
expect.arrayContaining([
3434
expect.objectContaining({
3535
description: 'test-otel-span',
36-
op: 'otel.span',
3736
origin: 'manual',
3837
}),
3938
]),
@@ -53,7 +52,6 @@ test('Sends transaction with OTel tracer.startActiveSpan', async ({ baseURL }) =
5352
expect.arrayContaining([
5453
expect.objectContaining({
5554
description: 'test-otel-active-span',
56-
op: 'otel.span',
5755
origin: 'manual',
5856
}),
5957
]),
@@ -77,7 +75,6 @@ test('OTel span appears as child of Sentry span (interop)', async ({ baseURL })
7775
}),
7876
expect.objectContaining({
7977
description: 'otel-child',
80-
op: 'otel.span',
8178
origin: 'manual',
8279
}),
8380
]),

packages/deno/src/opentelemetry/tracer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SentryDenoTracer implements Tracer {
4343
attributes: {
4444
...options?.attributes,
4545
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual',
46-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
46+
...(op ? { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op } : {}),
4747
'sentry.deno_tracer': true,
4848
},
4949
});
@@ -77,7 +77,7 @@ class SentryDenoTracer implements Tracer {
7777
attributes: {
7878
...opts.attributes,
7979
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual',
80-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
80+
...(op ? { [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op } : {}),
8181
'sentry.deno_tracer': true,
8282
},
8383
};
@@ -96,7 +96,7 @@ class SentryDenoTracer implements Tracer {
9696
return startSpanManual(spanOpts, callback) as ReturnType<F>;
9797
}
9898

99-
private _mapSpanKindToOp(kind?: SpanKind): string {
99+
private _mapSpanKindToOp(kind?: SpanKind): string | undefined {
100100
switch (kind) {
101101
case SpanKind.CLIENT:
102102
return 'http.client';
@@ -107,7 +107,7 @@ class SentryDenoTracer implements Tracer {
107107
case SpanKind.CONSUMER:
108108
return 'message.consume';
109109
default:
110-
return 'otel.span';
110+
return undefined;
111111
}
112112
}
113113
}

0 commit comments

Comments
 (0)