Skip to content

feat(boto3): Add Lambda extension - #8117

Merged
sentrivana merged 8 commits into
major/3.0from
pablo/boto3-add-lambda-extension
Nov 11, 2026
Merged

sentrivana merged 8 commits into
major/3.0from
pablo/boto3-add-lambda-extension

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the following attributes:

Other changes:

  • FunctionError sets error.type=lambda_function_error
  • whenever ClientContext.custom is available, we add trace propagation headers; trace continuing in aws-lambda integration is not done yet

Issues

Resolves #8069
Part of #8071

@pabloDeputter pabloDeputter changed the title Pablo/boto3 add lambda extension feat(boto3): Add Lambda extension Oct 23, 2026
@pabloDeputter
pabloDeputter marked this pull request as ready for review October 23, 2026 14:45
@pabloDeputter
pabloDeputter requested a review from a team as a code owner October 23, 2026 14:45
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 57873 passed | ❌ 1 failed | ⏭️ 3058 skipped | Total: 60932 | Pass Rate: 94.98% | Execution Time: 154m 3s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -84183
Passed Tests 📉 -79571
Failed Tests 📈 +1
Skipped Tests 📉 -4613

➕ New Tests (1)

View new tests
  • test_cache_spans_templatetag
    • File: tests.integrations.django.test_cache_module
    • Status: ❌ Failing

❌ Failed Tests

test_cache_spans_templatetag

File: tests.integrations.django.test_cache_module
Suite: py3.13-django-v5.2.19
Error: tests/integrations/django/test_cache_module.py:362: in test_cache_spans_templatetag assert not spans[0]["attributes"]["cache.hit"] E assert not True

Stack Trace
tests/integrations/django/test_cache_module.py:362: in test_cache_spans_templatetag
    assert not spans[0]["attributes"]["cache.hit"]
E   assert not True

✅ Patch coverage is 98.53% (67 of 68 changed executable lines covered; target 80%).
Project statement coverage is 90.38% (up 0.13 percentage points from base (88cea40) to head (15c6c69)).

Changed files with executable lines (5)
File Patch coverage Changed executable lines
sentry_sdk/integrations/boto3/_utils.py 88.89% 8/9 covered; missed: 55; partial branches: 52
sentry_sdk/integrations/boto3/services/lambda.py 100.00% 45/45 covered; partial branches: 47
sentry_sdk/consts.py 100.00% 10/10 covered
sentry_sdk/integrations/boto3/_client.py 100.00% 2/2 covered
sentry_sdk/integrations/boto3/_services/base.py 100.00% 2/2 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #8117       +/-##
==========================================
+ Coverage    90.25%    90.38%    +0.13%
==========================================
  Files          203       199        -4
  Tracked lines     27114     21598     -5516
  Branches     10136      7488     -2648
==========================================
- Hits         24470     19520     -4950
+ Misses        2644      2078      -566
+ Partials      1538      1253      -285

Generated by Coverage Action

sentrivana added a commit that referenced this pull request Oct 29, 2026
### Description

Removes `AwsCallContext.service_id_hyphenized` from
`sentry_sdk/integrations/boto3/_context.py`. It's still computed on
every call (`service_id.hyphenize()`), but on `major/3.0` nothing reads
it.

It had two readers. One was the `aws.service_id` span tag, which #7261
("Drop tags auto-set by the SDK") removed. The other was the span name:
#7800 ("align span names with OTel conventions") switched that to
`ctx.service_id`, so the hyphenized value lost its last reader. This
removes the slot, the attribute and the `hyphenize()` call.

**Evidence**
- On `major/3.0`, `git grep -w service_id_hyphenized` matches only the
three lines in `_context.py` that set it up.
- The open boto3 extension PRs against `major/3.0` (#8117 SQS, #8137
Lambda) don't reference it.

On `master`, `service_id_hyphenized` is still used for the span name and
the tag, so this only applies to `major/3.0`.

#### Issues
n/a

<!-- junior-request-attribution:start -->
via **Ivana Kellyer**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1793270559.842119 -->

--

[View Junior
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1793270559.842119)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1793270559.842119/?project=4510944073809921)

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

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
@sentrivana
sentrivana merged commit 86b2e98 into major/3.0 Nov 11, 2026
150 of 151 checks passed
@sentrivana
sentrivana deleted the pablo/boto3-add-lambda-extension branch November 11, 2026 09:39
sentrivana pushed a commit that referenced this pull request Nov 12, 2026
### Description

With #8117 (merged), a synchronous boto3 `Invoke` carries `sentry-trace`
and `baggage` in `ClientContext.custom`. This PR adds the receiving
side: the Lambda integration continues the trace from
`context.client_context.custom`. `ClientContext` wins over event
headers, because a forwarded HTTP event can still carry headers from
further upstream.

`sam local` drops `ClientContext`, so the new `ClientContextTrace` test
function hands the event's `client_context` to the runtime. That way the
container tests can cover it.

This is Pablo's code from `pablo/aws-lambda-client-context-trace`. The
one change: `client_context` and `custom` are read with `getattr`, so a
context object without them falls back to event headers instead of
failing. It's the first of three stacked PRs for the stretch Lambda
work: this PR → trigger detection (#8222) → `queue.process` spans
(#8223).

#### Issues
* resolves: PY-3009 (receiving side; #8117 does the injection)
* Part of #8071

<!-- 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: Pablo Deputter <pablo.deputter@sentry.io>
Co-authored-by: Pablo Deputter <71842639+pabloDeputter@users.noreply.github.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Johannes Daxböck <114897+dingsdax@users.noreply.github.com>
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.

3 participants