Repository navigation
feat(aws-lambda): Add queue.process spans for messaging triggers - #8223
Draft
sentry-junior[bot] wants to merge 3 commits into
Draft
sentry-junior[bot] wants to merge 3 commits into
sentry-junior[bot] wants to merge 3 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 📊✅ 57743 passed | ⏭️ 2979 skipped | Total: 60722 | Pass Rate: 95.09% | Execution Time: 154m 34s 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 30.16% (19 of 63 changed executable lines covered; target 80%). Changed files with executable lines (3)
Coverage diff@@ Coverage Diff @@
## master #8223 +/-##
==========================================
- Coverage 90.30% 89.92% -0.38%
==========================================
Files 203 199 -4
Tracked lines 26933 21485 -5448
Branches 10058 7442 -2616
==========================================
- Hits 24321 19320 -5001
+ Misses 2612 2165 -447
+ Partials 1518 1239 -279Generated 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>
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: SQS
messageAttributes, SNSMessageAttributes, and SQS bodies that wrap an SNS notification. 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.pyand the new process-span tests match his branch exactly. 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).MESSAGING_OPERATION_TYPEandMESSAGING_OPERATION_NAMEare also added in feat(boto3): Add SQS extension #8137, soconsts.pywill conflict when both land.Third of three stacked drafts (#8221 → #8222 → this).
Issues
queue.processspans for messaging triggers #8083via @dingsdax.
--
View Session [Sentry]