Skip to content

feat(aws-lambda): Add span streaming support to AWS Lambda integration#6498

Open
ericapisani wants to merge 6 commits into
masterfrom
py-2307-migrate-aws-lambda
Open

feat(aws-lambda): Add span streaming support to AWS Lambda integration#6498
ericapisani wants to merge 6 commits into
masterfrom
py-2307-migrate-aws-lambda

Conversation

@ericapisani
Copy link
Copy Markdown
Member

feat(aws-lambda): Add span streaming support to AWS Lambda integration

When span streaming is enabled via the trace_lifecycle experiment, use
sentry_sdk.traces.start_span instead of start_transaction so the function
span is emitted as a span envelope item with OTel-compatible attributes
(cloud.provider, cloud.platform, faas., aws.lambda.).

Also adds CLOUD_PLATFORM.AWS_LAMBDA constant and updates the test server
helper to route span envelope items into a separate span_items list so
tests can assert on streamed spans independently of error envelopes.

Depends on getsentry/sentry-conventions#414 being
shipped first as it introduces a number of the conventions used here

Fixes PY-2307
Fixes #6005

When span streaming is enabled via the trace_lifecycle experiment, use
sentry_sdk.traces.start_span instead of start_transaction so the function
span is emitted as a span envelope item with OTel-compatible attributes
(cloud.provider, cloud.platform, faas.*, aws.lambda.*).

Also adds CLOUD_PLATFORM.AWS_LAMBDA constant and updates the test server
helper to route span envelope items into a separate span_items list so
tests can assert on streamed spans independently of error envelopes.

Depends on getsentry/sentry-conventions#414 being
shipped first as it introduces a number of the conventions used here

Fixes PY-2307
Fixes #6005
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 3, 2026

PY-2307

@ericapisani
Copy link
Copy Markdown
Member Author

bugbot run
@sentry review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5bef11c. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Codecov Results 📊

88442 passed | ⏭️ 6022 skipped | Total: 94464 | Pass Rate: 93.63% | Execution Time: 299m 30s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +16
Passed Tests 📈 +16
Failed Tests
Skipped Tests

All tests are passing successfully.

❌ Patch coverage is 22.22%. Project has 2492 uncovered lines.
❌ Project coverage is 89.31%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/aws_lambda.py 19.23% ⚠️ 21 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    89.38%    89.31%    -0.07%
==========================================
  Files          192       192         —
  Lines        23285     23308       +23
  Branches      8002      8012       +10
==========================================
+ Hits         20811     20816        +5
- Misses        2474      2492       +18
- Partials      1309      1309         —

Generated by Codecov Action

@ericapisani ericapisani marked this pull request as ready for review June 3, 2026 19:40
@ericapisani ericapisani requested a review from a team as a code owner June 3, 2026 19:40
Comment thread sentry_sdk/integrations/aws_lambda.py Outdated
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

LGTM! But we need to wait for the conventions PR before merging 😴

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.

Migrate aws_lambda to span first

2 participants