Repository navigation
feat(aws-lambda): Add queue.process spans for messaging triggers - #8223
Open
sentry-junior[bot] wants to merge 8 commits into
Open
sentry-junior[bot] wants to merge 8 commits into
sentry-junior[bot] wants to merge 8 commits into
Conversation
For an SQS, SNS, Kafka, ActiveMQ or RabbitMQ delivery, the handler runs inside a queue.process child span (kind consumer) with messaging.system, messaging.operation.type and messaging.operation.name set to process, the batch message count, and the destination name when all records share it. The span links to each distinct producer context found in the records' Sentry message attributes: SQS messageAttributes, SNS MessageAttributes, and SQS bodies that wrap an SNS notification. Co-Authored-By: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
Contributor
Coverage Results 📊✅ 58862 passed | ⏭️ 3071 skipped | Total: 61933 | Pass Rate: 95.04% | Execution Time: 156m 55s 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 25.42% (15 of 59 changed executable lines covered; target 80%). Changed files with executable lines (2)
Coverage diff@@ Coverage Diff @@
## master #8223 +/-##
==========================================
- Coverage 90.24% 90.16% -0.08%
==========================================
Files 203 200 -3
Tracked lines 27125 21879 -5246
Branches 10142 7622 -2520
==========================================
- Hits 24478 19727 -4751
+ Misses 2647 2152 -495
+ Partials 1541 1255 -286Generated by Coverage Action |
…-process Co-Authored-By: johdax <114897+dingsdax@users.noreply.github.com> # Conflicts: # sentry_sdk/integrations/aws_lambda/_handler.py # sentry_sdk/integrations/aws_lambda/_trigger.py
The error is captured, both the process span and the invocation span are marked as errors, and the exception still reaches the Lambda runtime. Co-Authored-By: johdax <114897+dingsdax@users.noreply.github.com>
…-process Co-Authored-By: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
OTel sets faas.trigger on the FaaS span, which already has it. Also make the producer link cap private, like the other module constants. Co-Authored-By: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
This was referenced Nov 9, 2026
Matches the boto3 receive links from #8145.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0291824. Configure here.
A sentry-trace like "-1" parses with no trace_id or parent_span_id, which became a link to "None". Skip it, as boto3 receive links do.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
For an SQS or SNS delivery, the handler now runs inside a
queue.processchild span of kindconsumer. The span has:messaging.systemmessaging.operation.typeandmessaging.operation.name, bothprocessThe span links to each distinct producer context in the records' Sentry message attributes (at most 128 links): SQS
messageAttributes, SNSMessageAttributes, and SQS bodies that wrap an SNS notification. Each link hassentry.link.type: message_origin, like the boto3 receive links from #8145. This gives an SQS-triggered Lambda a link back to the request that sent the message. It also fills in the processing side of the Queues insight.This is Pablo's code from
pablo/aws-lambda-messaging, moved directly onto trigger detection (#8222). On his branch it sat on top of HTTP and invocation attribute work (PY-3017, PY-3019, PY-3021), which isn't part of the November plan. Moving it needed one hand-made change: in_handler.pyI kept the base handler and only wrapped the handler call in the process span, because Pablo's version of that block includes the HTTP status anderror.typecode from the dropped commits._trigger.pymatches his branch, minus his batch counting for the invocation span and thefaas.triggerattribute on the process span (it stays on the invocation span). The process-span tests match his branch. The only tests left out are the ones for the dropped attributes.test_process_span_errorcovers a handler that raises.Open points for review:
messaging.message.idon single-message process spans isn't added yet (proposed in PY-3020).Third of three stacked PRs (#8221 → #8222 → this).
Issues
queue.processspans for messaging triggers #8083via @dingsdax.
--
View Session [Sentry]