Skip to content

Commit 1c089b0

Browse files
committed
Calculate retries not attempts
The `message.attempts` property starts at 1 so we were calculating the number of attempts not the number of retries. Since attempt 2 is the first retry.
1 parent 85f9bd0 commit 1c089b0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/cloudflare/src/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
175175
'messaging.destination.name': batch.queue,
176176
'messaging.system': 'cloudflare',
177177
'messaging.batch.message_count': batch.messages.length,
178-
'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts, 0),
178+
'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0),
179179
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.process',
180180
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue',
181181
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',

packages/cloudflare/test/handler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ describe('withSentry', () => {
843843
'messaging.destination.name': batch.queue,
844844
'messaging.system': 'cloudflare',
845845
'messaging.batch.message_count': batch.messages.length,
846-
'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts, 0),
846+
'messaging.message.retry.count': batch.messages.reduce((acc, message) => acc + message.attempts - 1, 0),
847847
'sentry.sample_rate': 1,
848848
'sentry.source': 'task',
849849
},

0 commit comments

Comments
 (0)