GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(boto3): Add SNS extension by pabloDeputter · Pull Request #8142 · getsentry/sentry-python

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Oct 28, 2026 •
edited by sentry-junior Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Description

Adds the SNS extension to the boto3 integration, now SNS Publish and PublishBatch become queue.publish spans so they show up in the Queues insight; all other operations stay on rpc:

  • Publish, PublishBatch: queue.publish, kind producer (default is client), named send <topic>, or send <server.address>:<port> when the request has no destination

Adds the following attributes:

  • messaging.system (aws.sns), messaging.operation.type (send) and messaging.operation.name (publish) on the publish APIs (all from OTel)
  • messaging.batch.message_count on PublishBatch, messaging.message.id on Publish
  • aws.sns.topic.arn and messaging.destination.name (topic name) on every API with TopicArn, ResourceArn or a topic TargetArn; destination name also from CreateTopic's Name

Other changes:

  • PhoneNumber and platform-endpoint TargetArn publishes get messaging.destination.name=[Filtered] (send [Filtered])

Issues

Resolves #7573 & PY-2804

via @dingsdax.

--

View Session [Sentry]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
pabloDeputter added 6 commits October 27, 2026 17:59
@pabloDeputter
.
70dca2a
@pabloDeputter
wip
0f90423
@pabloDeputter
.
053099c
@pabloDeputter
fix(boto3): Add capture_internal_exceptions() guard to `get_span_na…
c73d9ba
…me()`
@pabloDeputter
fix(boto3): Simplify error type handling in batch operations
61994bf
@pabloDeputter
wip
6ccbcd8
@github-actions

github-actions Bot commented Oct 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 58478 passed | ⏭️ 3067 skipped | Total: 61545 | Pass Rate: 95.02% | Execution Time: 160m 10s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -85122
Passed Tests 📉 -80520
Failed Tests —
Skipped Tests 📉 -4602

All tests are passing successfully.

✅ Patch coverage is 100.00% (54 of 54 changed executable lines covered; target 80%).
Project statement coverage is 90.40% (up 0.13 percentage points from base (42cd7a7) to head (165dcf3)).

Changed files with executable lines (2)
File Patch coverage Changed executable lines
sentry_sdk/consts.py 100.00% 2/2 covered
sentry_sdk/integrations/boto3/_services/sns.py 100.00% 52/52 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #8142       +/-##
==========================================
+ Coverage    90.27%    90.40%    +0.13%
==========================================
  Files          203       199        -4
  Tracked lines     27114     21713     -5401
  Branches     10136      7546     -2590
==========================================
- Hits         24475     19628     -4847
+ Misses        2639      2085      -554
+ Partials      1540      1254      -286

Generated by Coverage Action

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pabloDeputter and others added 3 commits October 28, 2026 15:10
@pabloDeputter
Merge branch 'major/3.0' into pablo/boto3-add-sqs-extension
9235dd0
@pabloDeputter
Merge branch 'pablo/boto3-add-sqs-extension' into pablo/boto3-add-sns…
be20b35
…-extension
@pabloDeputter
add "publish_batch" method requirement
50a49d1
@pabloDeputter
pabloDeputter marked this pull request as ready for review October 28, 2026 15:05
@pabloDeputter
pabloDeputter requested a review from a team as a code owner October 28, 2026 15:05
@pabloDeputter
fix
4738824
@pabloDeputter pabloDeputter mentioned this pull request Oct 30, 2026
feat(boto3): Add SQS extension #8137
Merged
pabloDeputter and others added 3 commits October 30, 2026 13:55
@pabloDeputter
fix(boto3): make sure span is sent
c640799
- 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
@sentry-junior @dingsdax
Merge remote-tracking branch 'origin/major/3.0' into pablo/boto3-add-…
f6c8099
…sqs-extension

Co-Authored-By: Johannes Daxböck <[email protected]>
@sentry-junior @dingsdax
Merge branch 'pablo/boto3-add-sqs-extension' into pablo/boto3-add-sns…
0cb573d
…-extension

Co-Authored-By: Johannes Daxböck <[email protected]>
This was referenced Nov 9, 2026
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span #8219
Closed
feat(boto3): Add SQS/SNS trace propagation #8145
Merged
sentry-junior Bot and others added 3 commits November 9, 2026 12:31
@sentry-junior @dingsdax
ref(boto3): Guard SQS ARN and batch-count reads separately
48eae1c
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]>
@sentry-junior @dingsdax
Merge branch 'pablo/boto3-add-sqs-extension' into pablo/boto3-add-sns…
0e58846
…-extension

Co-Authored-By: Johannes Daxböck <[email protected]>
@sentry-junior @dingsdax
ref(boto3): Share the batch error.type code with SQS
54710b7
Co-Authored-By: Johannes Daxböck <[email protected]>
@sentry-junior sentry-junior Bot mentioned this pull request Nov 9, 2026
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span #8229
Merged
alexander-alderman-webb added 2 commits November 10, 2026 18:08
@alexander-alderman-webb
merge major branch
438ded1
@alexander-alderman-webb
merge
6588b5b
cursor[bot]
cursor Bot reviewed Nov 10, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_services/sns.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Base automatically changed from pablo/boto3-add-sqs-extension to major/3.0 November 11, 2026 12:10
sentry-junior Bot and others added 3 commits November 11, 2026 12:15
@sentry-junior
Merge branch 'major/3.0' into pablo/boto3-add-sns-extension
4d8e8f5
Co-Authored-By: Ivana Kellyer <[email protected]>

# Conflicts:
#	sentry_sdk/consts.py
#	sentry_sdk/integrations/boto3/_services/sqs.py
#	sentry_sdk/integrations/boto3/_utils.py
#	tests/integrations/boto3/test_sqs.py
@sentry-junior @sentrivana
fix(boto3): Guard SNS response attributes
e53db10
An SNS Publish response without MessageId (e.g. from a Stubber or an
SNS-compatible service) raised KeyError into the caller and left the
span open. Wrap the response reads like SQS does, so a bad shape only
loses those attributes.

Co-Authored-By: Ivana Kellyer <[email protected]>
@sentry-junior @sentrivana
fix(boto3): Guard SNS request attribute reads
ae87c83
botocore validates params after our hook, so a malformed TargetArn or
PublishBatchRequestEntries raised out of get_request_attributes and the
call ran without a span. Guard the topic, batch-count, and ARN reads
separately, like SQS, so a bad value only loses its own attributes. If
ARN scrubbing fails, drop the ARN attributes instead of sending raw
endpoint or subscription ARNs.

Co-Authored-By: Ivana Kellyer <[email protected]>
cursor[bot]
cursor Bot reviewed Nov 11, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ae87c83. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry_sdk/integrations/boto3/_services/sns.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentry-junior Bot and others added 2 commits November 11, 2026 12:35
@sentry-junior @sentrivana
test(boto3): Skip SNS invalid-params test when the operation is missing
a7efd55
PublishBatch isn't in older botocore models (e.g. boto3 1.16.63), so
skip like the other SNS tests do.

Co-Authored-By: Ivana Kellyer <[email protected]>
@sentry-junior @sentrivana
docs(boto3): Document SNS span op and name changes in migration guide
165dcf3
Co-Authored-By: Ivana Kellyer <[email protected]>
sentrivana
sentrivana approved these changes Nov 11, 2026
View reviewed changes
@sentrivana
sentrivana merged commit 36870b8 into major/3.0 Nov 11, 2026
156 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@sentrivana
sentrivana deleted the pablo/boto3-add-sns-extension branch November 11, 2026 12:50
sentrivana added a commit that referenced this pull request Nov 11, 2026
@pabloDeputter @sentry-junior
@dingsdax @sentrivana
feat(boto3): Add SQS/SNS trace propagation (#8145)
8abf619
### Description

Propagates the trace through SQS and SNS messages, so the consumer can
be linked back to the request that sent the message.

**Send side** (`SendMessage`, `SendMessageBatch`, `Publish`,
`PublishBatch`):
- Adds `sentry-trace` and `baggage` as `String` message attributes, on
the message or on each batch entry.
- Only when `trace_propagation_targets` match the endpoint.
- Skips a message if the caller already set these attributes, if it
would go over the 10-attribute limit, or if it would go over 256 KiB.
AWS would reject the message otherwise.
- Works on a copy of the params. The caller's dict isn't changed.

**Receive side** (`ReceiveMessage`):
- Adds `sentry-trace` and `baggage` to `MessageAttributeNames`, so SQS
returns them. Only when the span is recorded, and not when the caller
already asks for `All` or `.*`.
- Adds a span link to each distinct producer context in the received
messages, with `sentry.link.type: message_origin`.
- Reads the context from SQS message attributes, and from the JSON
envelope of an SNS notification without raw message delivery.

**Tests**: injection and extraction for single and batch calls, the
limits above, and a round-trip test: send a message, receive what was
injected, and check that the link points at the send span.

Stacked on #8142 (SNS), which is stacked on #8137 (SQS).

#### Issues
* resolves: PY-3008

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <[email protected]>
Co-authored-by: Ivana Kellyer <[email protected]>
Co-authored-by: Ivana Kellyer <[email protected]>
@sentry-junior sentry-junior Bot mentioned this pull request Nov 12, 2026
feat(aws-lambda): Link SQS and SNS invocations to their producers #8257
Merged
sentrivana added a commit that referenced this pull request Nov 12, 2026
@sentry-junior @alexander-alderman-webb @sentrivana
feat(aws-lambda): Link SQS and SNS invocations to their producers (#8257
3da95c6
)

### 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]>
sentrivana pushed a commit that referenced this pull request Nov 12, 2026
@sentry-junior @dingsdax
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda…
08ebd25
… span (#8229)

### Description

The Lambda span set `messaging.batch.message_count` to `1` for every
event that isn't a list, and to `len(event)` for a top-level list. An
SQS or SNS delivery is a dict with `Records`, so a batch of 10 messages
reported 1. HTTP calls and direct invocations reported a batch they
don't have.

This PR removes the attribute from the Lambda span. The count belongs on
messaging spans, as in the OTel messaging conventions:
- boto3 `ReceiveMessage` and batch-send spans already set it (#8137,
#8142).
- For SQS/SNS-triggered Lambdas, the `queue.process` span in #8223 sets
it.

The JS SDK doesn't set it on the Lambda span either. The attribute was
added in 3.0 (#7941) and never shipped in 2.x, so no released behavior
changes.

Replaces #8219 (same commits). GitHub never ran CI on #8219.

**Note for review:** this is narrower than PY-3015, which asks to keep
the attribute for SQS/SNS deliveries. @alexander-alderman-webb, please
confirm that's OK.

#### Issues
* resolves: PY-3015

<!-- junior-request-attribution:start -->
via @dingsdax.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C9X9V5NMT%3A1793904671.980379 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C9X9V5NMT%3A1793904671.980379/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@sentrivana sentrivana sentrivana approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@pabloDeputter @sentrivana @alexander-alderman-webb
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.