GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(boto3): Add SQS/SNS trace propagation by pabloDeputter · Pull Request #8145 · getsentry/sentry-python Conversation
|
Coverage Results 📊✅ 58786 passed | ⏭️ 3071 skipped | Total: 61857 | Pass Rate: 95.04% | Execution Time: 162m 7s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 94.44% (68 of 72 changed executable lines covered; target 80%). Changed files with executable lines (4)
Coverage diff@@ Coverage Diff @@ ## master #8145 +/-## ========================================== + Coverage 90.24% 90.45% +0.21% ========================================== Files 203 199 -4 Tracked lines 27125 21786 -5339 Branches 10142 7582 -2560 ========================================== - Hits 24478 19705 -4773 + Misses 2647 2081 -566 + Partials 1541 1254 -287 Generated by Coverage Action |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- stop reading operation type from attributes in `get_span_name()` so that failure in `get_request_attributes()` can't make this fail as well - wrap URL parsing in `get_request_attributes()` so failure just loses the attributes that come from url
…sqs-extension Co-Authored-By: Johannes Daxböck <[email protected]>
…-extension Co-Authored-By: Johannes Daxböck <[email protected]>
Co-Authored-By: Johannes Daxböck <[email protected]> # Conflicts: # sentry_sdk/integrations/boto3/_services/sqs.py
Send a message, receive what was injected, and check that the receive span links to the send span. Covers SQS and an SNS notification delivered to SQS without raw message delivery. Co-Authored-By: johdax <[email protected]>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Botocore validates params after our hook, so a bad Entries or ARN value now only loses that attribute, not every SQS request attribute. Move the batch error.type code to _utils so SNS can share it, and link the SQS docs for BatchResultErrorEntry. Co-Authored-By: Johannes Daxböck <[email protected]>
…-extension Co-Authored-By: Johannes Daxböck <[email protected]>
Co-Authored-By: Johannes Daxböck <[email protected]>
…/sns-propagation Co-Authored-By: Johannes Daxböck <[email protected]> # Conflicts: # sentry_sdk/integrations/boto3/_services/sns.py # sentry_sdk/integrations/boto3/_services/sqs.py # sentry_sdk/integrations/boto3/_utils.py
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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 7d93a71. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: Ivana Kellyer <[email protected]>
### Description Adds `Boto3Integration(propagate_traces=True)`. Setting it to `False` stops the integration from changing the request params of AWS calls: - Lambda `Invoke` no longer gets trace data in `ClientContext`. - Once #8145 lands: SQS `SendMessage` / `SendMessageBatch` and SNS `Publish` / `PublishBatch` no longer get `sentry-trace` / `baggage` message attributes, and SQS `ReceiveMessage` no longer appends our names to `MessageAttributeNames`. The option gates the shared `get_request_params` hook, so it covers every extension that uses it without per-service changes. Spans are still created as before. This is an escape hatch for setups where the added data breaks calls, e.g. a queue or topic whose `MaximumMessageSize` is set below the 256 KiB the #8145 size check assumes, or consumers that reject unknown attributes. The name matches `CeleryIntegration(propagate_traces=...)`. HTTP `sentry-trace` / `baggage` headers on AWS requests are not affected. They're also added by the stdlib integration and are already controlled by `trace_propagation_targets`. Independent of #8145. The SQS/SNS test cases pass trivially until #8145 is merged, and guard the option after that. Whichever PR merges second needs a small conflict fix at the end of `test_trace_propagation.py`, since both append tests there. <!-- junior-request-attribution:start --> via @sentrivana. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1794401901.814229 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1794401901.814229) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1794401901.814229/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Ivana Kellyer <[email protected]> Co-authored-by: Ivana Kellyer <[email protected]>
…sqs/sns-propagation Co-Authored-By: Ivana Kellyer <[email protected]> # Conflicts: # tests/integrations/boto3/test_trace_propagation.py
There was an error while loading. Please reload this page.
Matches the boto3 receive links from #8145.
) ### Description Since #8137, #8142, and #8145, boto3 puts `sentry-trace` in SQS and SNS message attributes, but nothing reads it on the Lambda side. This PR is the smallest change that closes the loop for SQS- and SNS-triggered functions. The Lambda integration now reads `sentry-trace` from each record and adds a `message_origin` link from the invocation span to each distinct producer span. This matches what the boto3 `ReceiveMessage` span already does. Messages never become the invocation's parent. It reads: - SQS records: `messageAttributes["sentry-trace"].stringValue` - SNS records: `Sns.MessageAttributes["sentry-trace"].Value` - SNS → SQS without raw message delivery: the SNS envelope in the SQS `body`, the same as boto3 does Links are deduplicated, because a batch send gives many messages the same producer span, and capped at 128, OTel's default, because Lambda can deliver up to 10,000 SQS messages at once. **Scope.** This is intentionally kept separate from the stretch stack. It doesn't add `faas.trigger` (#8222) or `queue.process` spans (#8223), and it doesn't touch `messaging.batch.message_count` (#8229). The invocation span is otherwise unchanged. Synchronous `Invoke` propagation through `ClientContext` is #8221. That PR changes the `continue_trace` call and this one only adds `links=`, so the two are independent. The link-building code repeats boto3's `_message_link` in a Lambda-event shape: Lambda records use `messageAttributes` / `stringValue` / `body`, while the boto3 response uses `MessageAttributes` / `StringValue` / `Body`. Importing from the boto3 integration would make `aws_lambda` depend on botocore. **Testing.** `test_producer_links` sends SQS, SNS, and SNS-to-SQS events to `BasicOkSpanStreaming`. It asserts the segment span's `links` and that the segment span has no parent. It passes in CI's Cloud (Lambda) jobs, and `ruff` and `mypy sentry_sdk` pass. `codecov/patch` is red because the Lambda tests run in `sam local` containers, so their coverage isn't counted. #### Issues * Part of #8081 <!-- junior-request-attribution:start --> via **webb**, @sentrivana. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC09M26BC6A1%3A1794211222.463239 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC09M26BC6A1%3A1794211222.463239) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC09M26BC6A1%3A1794211222.463239/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Alexander Webb <[email protected]> Co-authored-by: Ivana Kellyer <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.