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(aws-lambda): Add Lambda runtime resource attributes by pabloDeputter · Pull Request #7941 · getsentry/sentry-python

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Oct 9, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Description

Expand aws-lambda instrumentation with extra resource identity and runtime metadata following OTel (https://opentelemetry.io/docs/specs/semconv/faas/aws-lambda/).

Changes:

  • add sentry.kind=server.
  • add cloud.account.id, extracted from the invoked function ARN.
  • cloud.resource_id is now normalized from the invoked function ARN; keep the original value in aws.lambda.invoked_arn and replace an alias with the resolved published version when the function is not $LATEST.
  • cloud.region is now extracted from AWS_REGION env. var; faas.name from AWS_LAMBDA_FUNCTION_NAME; faas.version from AWS_LAMBDA_FUNCTION_VERSION following OTel (https://opentelemetry.io/docs/specs/semconv/faas/aws-lambda/#resource-detector).
  • refresh sentry_sdk on every test setup (for easier local testing so runs don’t reuse old behavior from earlier implementation).
  • add capture_internal_exceptions() around attribute extraction so that a single failure does not affect the other instrumentation.

Issues

Resolves #7931

Sorry, something went wrong.

Uh oh!

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

All reactions
@pabloDeputter
pabloDeputter added this pull request to stack #7940 October 9, 2026 12:55
@pabloDeputter
pabloDeputter force-pushed the pablo/add-lambda-runtime-attributes branch from abe3bfa to f1f8c35 Compare October 9, 2026 12:56
@github-actions

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

Uh oh!

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

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 56199 passed | ⏭️ 2872 skipped | Total: 59071 | Pass Rate: 95.14% | Execution Time: 155m 37s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -81871
Passed Tests 📉 -77467
Failed Tests —
Skipped Tests 📉 -4404

All tests are passing successfully.

❌ Patch coverage is 25.00% (6 of 24 changed executable lines covered; target 80%).
Project statement coverage is 90.00% (down 0.25 percentage points from base (009f15f) to head (295d5c3)).

Changed files with executable lines (2)
File Patch coverage Changed executable lines
sentry_sdk/integrations/aws_lambda/_handler.py 19.05% 4/21 covered; missed: 116, 117, 118, 119, 120, 121, 127, 140, 156, 168, 169, 170, 171, 172, 173, 174, 176
sentry_sdk/integrations/aws_lambda/_request.py 66.67% 2/3 covered; missed: 120
Coverage diff
@@            Coverage Diff             @@
##        master     #7941       +/-##
==========================================
- Coverage    90.25%    90.00%    -0.25%
==========================================
  Files          202       197        -5
  Tracked lines     26660     20983     -5677
  Branches      9926      7208     -2718
==========================================
- Hits         24062     18885     -5177
+ Misses        2598      2098      -500
+ Partials      1510      1234      -276

Generated by Coverage Action

All reactions

Sorry, something went wrong.

Uh oh!

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

@pabloDeputter
pabloDeputter marked this pull request as ready for review October 9, 2026 13:12
@pabloDeputter
pabloDeputter requested a review from a team as a code owner October 9, 2026 13:12
sentry-warden[bot]
sentry-warden Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/aws_lambda/_handler.py Resolved

Uh oh!

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

sentry-warden[bot]
sentry-warden Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/aws_lambda/_handler.py Resolved

Uh oh!

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

Comment thread sentry_sdk/integrations/aws_lambda/consts.py Resolved

Uh oh!

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

sentry-warden[bot]
sentry-warden Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/aws_lambda/_metadata.py Resolved

Uh oh!

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

sentry-warden[bot]
sentry-warden Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/aws_lambda/_handler.py Resolved

Uh oh!

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

@pabloDeputter
pabloDeputter force-pushed the pablo/add-lambda-runtime-attributes branch from 2060499 to d5b8521 Compare October 12, 2026 09:06
sentry-warden[bot]
sentry-warden Bot reviewed Oct 12, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/aws_lambda/_handler.py Resolved

Uh oh!

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

@pabloDeputter
pabloDeputter removed this pull request from stack #7940 October 15, 2026 18:35
@pabloDeputter
pabloDeputter added this pull request to stack #8043 October 15, 2026 19:20
@pabloDeputter
pabloDeputter force-pushed the pablo/add-lambda-runtime-attributes branch from d5b8521 to c191469 Compare October 15, 2026 19:20
sentrivana
sentrivana requested changes Oct 16, 2026
View reviewed changes

@sentrivana sentrivana left a comment

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.

See comment 🙏🏻

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread sentry_sdk/integrations/aws_lambda/_metadata.py Outdated
return _lambda_metadata_cache[1]

# bearer token is required to prevent SSRF.
response = _lambda_metadata_http.request(

@sentrivana sentrivana Oct 16, 2026

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.

We can't make requests from the SDK. We need to only work with what we can intercept from the natural execution of a user's program without creating side effects like network or DB traffic that are not necessary for making the SDK work (e.g. sending events to Sentry).

Can we get this info from elsewhere? If not, let's not add it.

Sorry, something went wrong.

Uh oh!

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

All reactions

@pabloDeputter pabloDeputter Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

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.

ok yeah makes sense, didn't think about this.

It's not really available anywhere else, so I'll remove it.

Sorry, something went wrong.

Uh oh!

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

All reactions
Base automatically changed from pablo/cleanup-lambda to major/3.0 October 16, 2026 12:56
pabloDeputter added 9 commits October 16, 2026 15:35
@pabloDeputter
.
03c7807
@pabloDeputter
.
416aa76
@pabloDeputter
add has_span_streaming_enabled(client.options) conditional
5ede224
@pabloDeputter
lint
857ef30
@pabloDeputter
.
a62c55d
@pabloDeputter
.
5932767
@pabloDeputter
use vars
1ba4dcf
@pabloDeputter
add version tests
73de8ab
@pabloDeputter
remove everything related to AZ
295d5c3
@pabloDeputter
pabloDeputter force-pushed the pablo/add-lambda-runtime-attributes branch from f7d4930 to 295d5c3 Compare October 16, 2026 13:35
@pabloDeputter
pabloDeputter requested a review from sentrivana October 16, 2026 13:37
sentrivana
sentrivana approved these changes Oct 19, 2026
View reviewed changes
@pabloDeputter
pabloDeputter merged commit daf055c into major/3.0 Oct 19, 2026
152 of 153 checks passed

Uh oh!

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

@pabloDeputter
pabloDeputter deleted the pablo/add-lambda-runtime-attributes branch October 19, 2026 08:29
This was referenced Nov 9, 2026
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span #8219
Closed
fix(aws-lambda): Remove messaging.batch.message_count from the Lambda span #8229
Merged
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

@sentry-warden sentry-warden[bot] sentry-warden[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.

feat(aws-lambda): Add AWS cloud attributes

Uh oh!

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

2 participants

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