Skip to content

Commit 412de1f

Browse files
committed
Look at first record eventSource in aws lambda event Records array to determine if it is an sqs event
1 parent af3ef72 commit 412de1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/instrumentation-aws-lambda/src/instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export class AwsLambdaInstrumentation extends InstrumentationBase<AwsLambdaInstr
287287
}
288288

289289
return otelContext.with(trace.setSpan(parent, span), () => {
290-
if (event.Records) {
290+
if (event.Records && event.Records[0].eventSource === 'aws:sqs') {
291291
const messages = event.Records;
292292
const queueArn = messages[0]?.eventSourceARN;
293293
const queueName = queueArn?.split(':').pop() ?? 'unknown';

0 commit comments

Comments
 (0)