Skip to content

feat(boto3): Add common OTel AWS client attributes - #7481

Open
pabloDeputter wants to merge 1 commit into
pablo/trace-boto3-client-call-lifecyclefrom
pablo/improve-boto3-call-lifecycle
Open

pabloDeputter wants to merge 1 commit into
pablo/trace-boto3-client-call-lifecyclefrom
pablo/improve-boto3-call-lifecycle

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

Implements #7475 by adding common OTel attributes to boto client spans.

Changes

  • add the following attributes: rpc.system.name, rpc.service, rpc.method, cloud.region, server.address, server.port.
  • set rpc.system.name to aws-api
  • changing span name to Service.Operation (now it's aws.<service>.<Operation>), e.g. S3.HeadObject following OTel is a breaking change and will be done in major.
  • use modeled AWS service for rpc.service; not supported anymore by OTel, but JS keeps this too.
  • use boto operation name for rpc.method.
  • extend AwsCallContext to carry extra client metadata for instrumentation.

Issues

Resolves #7475

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

128609 passed | ⏭️ 7151 skipped | Total: 135760 | Pass Rate: 94.73% | Execution Time: 435m 52s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +303
Passed Tests 📈 +283
Failed Tests
Skipped Tests 📈 +20

All tests are passing successfully.

✅ Patch coverage is 88.24%. Project has 2534 uncovered lines.
✅ Project coverage is 90.24%. Comparing base (05501d2) to head (0d61ef8).

Files with missing lines (2)
File Patch % Lines
sentry_sdk/integrations/boto3/_instrumentation.py 81.82% ⚠️ 6 Missing and 4 partials
sentry_sdk/integrations/boto3/_context.py 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
+ Coverage    90.18%    90.24%    +0.06%
==========================================
  Files          193       196        +3
  Lines        25773     25960      +187
  Branches      9532      9578       +46
==========================================
+ Hits         23241     23426      +185
- Misses        2532      2534        +2
- Partials      1431      1439        +8

Generated by Codecov Action

@pabloDeputter pabloDeputter changed the title feat(boto3): improve boto3 integration feat(boto3): trace logical AWS calls with common attributes Sep 11, 2026
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py Outdated
Comment thread sentry_sdk/consts.py
@pabloDeputter
pabloDeputter marked this pull request as ready for review September 14, 2026 09:26
@pabloDeputter
pabloDeputter requested a review from a team as a code owner September 14, 2026 09:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/boto3/_instrumentation.py
Comment thread tests/integrations/boto3/test_s3.py Outdated
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py
Comment thread tests/integrations/boto3/test_client.py Outdated
@pabloDeputter
pabloDeputter added this pull request to stack #7500 September 14, 2026 12:53
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py
Comment thread sentry_sdk/integrations/boto3/__init__.py Outdated
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
Comment thread sentry_sdk/integrations/boto3/_instrumentation.py
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch from 9fe9acf to 4e8f427 Compare September 14, 2026 14:42
Comment thread tests/integrations/boto3/test_client.py
Comment thread sentry_sdk/integrations/boto3/__init__.py
Comment thread sentry_sdk/integrations/boto3/_client.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
except BaseException as exc:
if span is not None:
with capture_internal_exceptions():
_finish_active_http_child_span(span)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we ending the stdlib span here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We finish the HTTP span before the parent boto3 span so that the correct order is preserved. Otherwise the HTTP span would be kept active until the whole response is read, while the parent boto3 span finishes first; afterwards when the HTTP span finishes, it will restore the already-finished parent as current, causing subsequent calls to be parented incorrectly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can send a screenshot from sentry maybe to show against latest release

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

old:
Screenshot 2026-09-15 at 14 18 55
new:
Screenshot 2026-09-15 at 14 18 46

@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch from aa1d65a to 939a3f8 Compare September 15, 2026 12:58

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/boto3/__init__.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/boto3/_client.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch 2 times, most recently from ddf5deb to 351e3b6 Compare September 17, 2026 15:50

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit afcb977. Configure here.

Comment thread sentry_sdk/integrations/boto3/_client.py
@pabloDeputter pabloDeputter changed the title feat(boto3): trace logical AWS calls with common attributes feat(boto3): add common OTel AWS client attributes Sep 18, 2026
@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch from f98d2f2 to 77468b1 Compare September 18, 2026 14:30
@pabloDeputter pabloDeputter changed the title feat(boto3): add common OTel AWS client attributes feat(boto3): Add common OTel AWS client attributes Sep 18, 2026
@pabloDeputter
pabloDeputter removed this pull request from stack #7500 September 18, 2026 14:34
@pabloDeputter
pabloDeputter changed the base branch from master to pablo/trace-boto3-client-call-lifecycle September 18, 2026 14:34
@pabloDeputter
pabloDeputter added this pull request to stack #7539 September 18, 2026 14:35
@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch from 77468b1 to 6ea0078 Compare September 18, 2026 15:06
@pabloDeputter
pabloDeputter removed this pull request from stack #7539 September 18, 2026 15:08
@pabloDeputter
pabloDeputter added this pull request to stack #7541 September 18, 2026 15:08
@pabloDeputter
pabloDeputter force-pushed the pablo/improve-boto3-call-lifecycle branch from 6ea0078 to 0d61ef8 Compare September 18, 2026 15:20
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.

feat(boto3): Add generic attributes that are common across services

2 participants