diff --git a/packages/cloudflare/package.json b/packages/cloudflare/package.json index f4ea3da77209..5fe7f845ea43 100644 --- a/packages/cloudflare/package.json +++ b/packages/cloudflare/package.json @@ -53,6 +53,7 @@ }, "dependencies": { "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/server-utils": "10.67.0", "magic-string": "~0.30.21" diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts index a99b81c6c341..00e532d6bf8c 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentQueue.ts @@ -1,8 +1,9 @@ import type { ExportedHandler, MessageBatch } from '@cloudflare/workers-types'; import type { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; +import { SENTRY_OP } from '@sentry/conventions/attributes'; +import { MESSAGING_QUEUE_PROCESS_SPAN_OP } from '@sentry/conventions/op'; import { captureException, - SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan, @@ -36,9 +37,9 @@ function wrapQueueHandler( return startSpan( { - op: 'faas.queue', name: `process ${batch.queue}`, attributes: { + [SENTRY_OP]: MESSAGING_QUEUE_PROCESS_SPAN_OP, 'faas.trigger': 'pubsub', 'messaging.destination.name': batch.queue, 'messaging.system': 'cloudflare', @@ -46,7 +47,6 @@ function wrapQueueHandler( 'messaging.operation.name': 'process', 'messaging.batch.message_count': batch.messages.length, 'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0), - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.process', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue', [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task', },