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 — fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span by sentry-junior[bot] · Pull Request #8219 · getsentry/sentry-python

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 9, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

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 (feat(boto3): Add SQS extension #8137, feat(boto3): Add SNS extension #8142).
  • For SQS/SNS-triggered Lambdas, the queue.process span in feat(aws-lambda): Add queue.process spans for messaging triggers #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.

The first version of this PR counted SQS/SNS records instead. This version is smaller, and it removes the overlap with #8222.

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

via @dingsdax.

--

View Session [Sentry]

Sorry, something went wrong.

Uh oh!

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

All reactions
@sentry-junior @dingsdax
fix(aws-lambda): Only set messaging.batch.message_count for SQS and S…
46ed68d
…NS batches

The Lambda span set messaging.batch.message_count to 1 for every non-list
event 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, and HTTP or
direct invocations reported a batch they don't have.

Set it only when all records come from SQS or SNS, to the number of
records.

Co-Authored-By: Johannes Daxböck <[email protected]>
@sentry-junior sentry-junior Bot assigned dingsdax Nov 9, 2026
@sentry-junior
sentry-junior Bot added this pull request to stack #8220 November 9, 2026 07:10
@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

PY-3015

sentry-junior[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

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

@sentry-junior sentry-junior Bot mentioned this pull request Nov 9, 2026
feat(aws-lambda): Detect Lambda triggers #8222
Merged
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 57860 passed | ⏭️ 3008 skipped | Total: 60868 | Pass Rate: 95.06% | Execution Time: 157m 36s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -83809
Passed Tests 📉 -79361
Failed Tests —
Skipped Tests 📉 -4448

All tests are passing successfully.

❌ Patch coverage is 13.33% (2 of 15 changed executable lines covered; target 80%).
Project statement coverage is 90.34% (up 0.03 percentage points from base (df16ce5) to head (46ed68d)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/integrations/aws_lambda/_handler.py 13.33% 2/15 covered; missed: 47, 48, 50, 51, 52, 54, 60, 61, 63, 189, 190, 191, 192
Coverage diff
@@            Coverage Diff             @@
##        master     #8219       +/-##
==========================================
+ Coverage    90.31%    90.34%    +0.03%
==========================================
  Files          203       199        -4
  Tracked lines     26933     21316     -5617
  Branches     10058      7374     -2684
==========================================
- Hits         24321     19256     -5065
+ Misses        2612      2060      -552
+ Partials      1518      1233      -285

Generated by Coverage Action

sentry-junior[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

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

@sentry-junior @dingsdax
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda…
9337a81
… span

Replace the SQS/SNS record counting with a plain removal. The count
belongs on messaging spans (boto3 receive and batch-send spans, and the
queue.process span for SQS/SNS triggers), as in the OTel messaging
conventions. The JS SDK doesn't set it on the Lambda span either.

The attribute was added in 3.0 and never shipped in 2.x.

Co-Authored-By: johdax <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(aws-lambda): Only set messaging.batch.message_count for SQS and SNS batches fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span Nov 9, 2026
sentry-junior Bot added a commit that referenced this pull request Nov 9, 2026
@sentry-junior @dingsdax
ref(aws-lambda): Don't set messaging.batch.message_count on the Lambd…
f864c51
…a span

Keep the count on messaging spans only (boto3 receive and batch-send
spans, and queue.process for SQS/SNS triggers), as in the OTel
messaging conventions and the JS SDK. This drops the batch counting for
Kafka, MQ and RabbitMQ deliveries, and matches #8219 so both PRs change
these lines the same way.

Co-Authored-By: johdax <[email protected]>
@sentry-junior
ci: Trigger CI (the previous push started no workflows)
1c10668
@sentry-junior sentry-junior Bot closed this Nov 9, 2026
@sentry-junior sentry-junior Bot reopened this Nov 9, 2026
@sentry-junior @dingsdax
test(aws-lambda): Drop the unused batch_size column in test_non_dict_…
c42e110
…event

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
@sentry-junior

sentry-junior Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #8229 (same commits, new branch junior/aws-lambda-span-no-batch-count). GitHub had this PR in a broken stack, so it never worked out the merge status and never ran CI.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sentry-junior sentry-junior Bot closed this Nov 9, 2026
sentrivana
sentrivana reviewed Nov 9, 2026
View reviewed changes

@sentrivana sentrivana left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Collaborator

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.

@sentry-junior unstack this PR from the major branch please

Sorry, something went wrong.

Uh oh!

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

dingsdax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@sentry-junior
sentry-junior Bot removed this pull request from stack #8220 November 9, 2026 13:54
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

@sentrivana sentrivana sentrivana left review comments

Uh oh!

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

Assignees

@dingsdax dingsdax

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.

2 participants

@sentrivana @dingsdax
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.