Skip to content

Commit 2fb88c6

Browse files
committed
Address review comments
1 parent db6b9f1 commit 2fb88c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/integrations/supabase.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,10 @@ function _processConsumerSpan(span: Span, res: SupabaseResponse, queueName: stri
726726
}
727727

728728
// Extract retry count from PGMQ read_ct field
729-
const retryCount = _getMessageProperty<number>(firstItem, 'read_ct') ?? 0;
729+
// read_ct represents total reads starting at 1 for the first read, so retry count = read_ct - 1
730+
// Math.max ensures we don't return negative values for invalid/missing read_ct
731+
const readCount = _getMessageProperty<number>(firstItem, 'read_ct') ?? 0;
732+
const retryCount = Math.max(0, readCount - 1);
730733
span.setAttribute('messaging.message.retry.count', retryCount);
731734

732735
// Calculate message body size with performance safeguards
@@ -1073,7 +1076,8 @@ function _instrumentRpcProducer(target: unknown, thisArg: unknown, argumentsList
10731076
}
10741077

10751078
// Create new arguments list with the modified params (don't mutate original argumentsList)
1076-
const modifiedArgumentsList = [argumentsList[0], paramsWithTrace];
1079+
// Preserve any additional arguments beyond the second (e.g., options object)
1080+
const modifiedArgumentsList = [argumentsList[0], paramsWithTrace, ...argumentsList.slice(2)];
10771081

10781082
const promise = Reflect.apply(
10791083
target as (...args: unknown[]) => Promise<unknown>,

0 commit comments

Comments
 (0)