Skip to content

Commit b39334a

Browse files
msonnbclaude
andcommitted
fix(cloudflare): Remove conflicting faas.queue op on queue consumer spans
The span passed both `op: 'faas.queue'` and a `sentry.op` attribute of `queue.process`. The attribute wins, so `faas.queue` was dead. Emitted spans are unchanged. Ref: JS-3105 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 07f72bb commit b39334a

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

packages/cloudflare/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
},
5454
"dependencies": {
5555
"@opentelemetry/api": "^1.9.1",
56+
"@sentry/conventions": "^0.16.0",
5657
"@sentry/core": "10.67.0",
5758
"@sentry/server-utils": "10.67.0",
5859
"magic-string": "~0.30.21"

packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import type { ExportedHandler, MessageBatch } from '@cloudflare/workers-types';
22
import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
3-
import {
4-
captureException,
5-
SEMANTIC_ATTRIBUTE_SENTRY_OP,
6-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
7-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
8-
startSpan,
9-
withIsolationScope,
10-
} from '@sentry/core';
3+
import { SENTRY_ORIGIN, SENTRY_SOURCE } from '@sentry/conventions/attributes';
4+
import { MESSAGING_QUEUE_PROCESS_SPAN_OP } from '@sentry/conventions/op';
5+
import { captureException, startSpan, withIsolationScope } from '@sentry/core';
116
import type { CloudflareOptions } from '../../client';
127
import { flushAndDispose } from '../../flush';
138
import { ensureInstrumented } from '../../instrument';
@@ -36,7 +31,7 @@ function wrapQueueHandler(
3631

3732
return startSpan(
3833
{
39-
op: 'faas.queue',
34+
op: MESSAGING_QUEUE_PROCESS_SPAN_OP,
4035
name: `process ${batch.queue}`,
4136
attributes: {
4237
'faas.trigger': 'pubsub',
@@ -46,9 +41,9 @@ function wrapQueueHandler(
4641
'messaging.operation.name': 'process',
4742
'messaging.batch.message_count': batch.messages.length,
4843
'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0),
49-
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.process',
50-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue',
51-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',
44+
[SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue',
45+
// oxlint-disable-next-line no-deprecated (todo(v11): migrate to SENTRY_SPAN_SOURCE)
46+
[SENTRY_SOURCE]: 'task',
5247
},
5348
},
5449
async () => {

0 commit comments

Comments
 (0)