Skip to content

fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span - #8229

Draft
sentry-junior[bot] wants to merge 4 commits into
major/3.0from
junior/aws-lambda-span-no-batch-count
Draft

sentry-junior[bot] wants to merge 4 commits into
major/3.0from
junior/aws-lambda-span-no-batch-count

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 9, 2026

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:

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

via @dingsdax.

--

View Session [Sentry]

sentry-junior Bot and others added 4 commits November 9, 2026 07:10
…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 <114897+dingsdax@users.noreply.github.com>
… 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 <114897+dingsdax@users.noreply.github.com>
…event

Co-Authored-By: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

PY-3015

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 57835 passed | ❌ 1 failed | ⏭️ 3008 skipped | Total: 60844 | Pass Rate: 95.05% | Execution Time: 160m 46s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -83833
Passed Tests 📉 -79386
Failed Tests 📈 +1
Skipped Tests 📉 -4448

✅ Patch coverage is 100.00% (no changed executable lines found; target 80%).
Project statement coverage is 90.39% (up 0.04 percentage points from base (df16ce5) to head (c42e110)).

Files with missing lines (1)
File Coverage % Lines
sentry_sdk/integrations/aws_lambda/_handler.py 19.54% ⚠️ 70 Missing
Coverage diff
@@            Coverage Diff             @@
##        master     #8229       +/-##
==========================================
+ Coverage    90.35%    90.39%    +0.04%
==========================================
  Files          203       199        -4
  Tracked lines     26931     21301     -5630
  Branches     10058      7366     -2692
==========================================
- Hits         24331     19253     -5078
+ Misses        2600      2048      -552
+ Partials      1517      1234      -283

Generated by Coverage Action

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant