Skip to content

feat(boto3): Add response, retry, and error span attributes - #7499

Open
pabloDeputter wants to merge 1 commit into
pablo/improve-boto3-call-lifecyclefrom
pablo/add-boto3-response-retry-error-attributes
Open

pabloDeputter wants to merge 1 commit into
pablo/improve-boto3-call-lifecyclefrom
pablo/add-boto3-response-retry-error-attributes

Conversation

@pabloDeputter

@pabloDeputter pabloDeputter commented Sep 14, 2026

Copy link
Copy Markdown
Member

Description

Add generic response, retry, and error attribute enrichment to boto3 spans. Previously, only recorded request and client metadata was instrumented; information after the call such as HTTP status, retry count, etc was omitted. The new attributes follow the OTel AWS SDK conventions.

Changes

  • add SPANDATA consts: AWS_REQUEST_ID, AWS_EXTENDED_REQUEST_ID, HTTP_REQUEST_RESEND_COUNT, and ERROR_TYPE.
  • add _get_response_attributes() to extract http.response_status_code, http.request_resend_count, aws.request_id, and aws.extended_request_id.
  • Add erorr.type from ClientError.Eror.Code or the exception class, without recording error messages.

Issues

Resolves #7476

@pabloDeputter
pabloDeputter added this pull request to stack #7500 September 14, 2026 12:53
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

128998 passed | ❌ 1 failed | ⏭️ 7151 skipped | Total: 136150 | Pass Rate: 94.75% | Execution Time: 429m 7s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +693
Passed Tests 📈 +672
Failed Tests 📈 +1
Skipped Tests 📈 +20

➕ New Tests (1)

View new tests
  • test_segment_uses_downsampled_rate
    • File: tests.test_monitor
    • Status: ❌ Failing

❌ Failed Tests

test_segment_uses_downsampled_rate

File: tests.test_monitor
Suite: py3.8-gevent
Error: assert 0.25 == 0.5 + where 0.25 = <NoOpStreamedSpan(sampled=False)>._sample_rate

Stack Trace
tests/test_monitor.py:116: in test_segment_uses_downsampled_rate
    assert segment._sample_rate == 0.5
E   assert 0.25 == 0.5
E    +  where 0.25 = <NoOpStreamedSpan(sampled=False)>._sample_rate

✅ Patch coverage is 100.00%. Project has 2533 uncovered lines.
✅ Project coverage is 90.27%. Comparing base (0d61ef8) to head (d55060f).

Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
+ Coverage    90.18%    90.27%    +0.09%
==========================================
  Files          193       196        +3
  Lines        25773     26024      +251
  Branches      9532      9606       +74
==========================================
+ Hits         23241     23491      +250
- Misses        2532      2533        +1
- Partials      1431      1439        +8

Generated by Codecov Action

@pabloDeputter pabloDeputter changed the title Pablo/add boto3 response retry error attributes feat(boto3): Add response, retry, and error span attributes Sep 14, 2026
@pabloDeputter
pabloDeputter force-pushed the pablo/add-boto3-response-retry-error-attributes branch from a15c641 to 56a7ab6 Compare September 14, 2026 14:42
@pabloDeputter
pabloDeputter force-pushed the pablo/add-boto3-response-retry-error-attributes branch from 56a7ab6 to 176096b Compare September 15, 2026 12:58
Comment thread tests/integrations/boto3/test_client.py
@pabloDeputter
pabloDeputter force-pushed the pablo/add-boto3-response-retry-error-attributes branch from af6b9a8 to 49474d0 Compare September 17, 2026 15:48
@pabloDeputter
pabloDeputter force-pushed the pablo/add-boto3-response-retry-error-attributes branch 2 times, most recently from 2e63bac to 35f0dc3 Compare September 17, 2026 16:00
@pabloDeputter
pabloDeputter marked this pull request as ready for review September 17, 2026 16:07
@pabloDeputter
pabloDeputter requested a review from a team as a code owner September 17, 2026 16:07
@pabloDeputter
pabloDeputter force-pushed the pablo/add-boto3-response-retry-error-attributes branch from 76e7425 to f922864 Compare September 18, 2026 13:02

@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 f922864. Configure here.

Comment thread sentry_sdk/integrations/boto3/_client.py Outdated
@pabloDeputter
pabloDeputter removed this pull request from stack #7500 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/add-boto3-response-retry-error-attributes branch from 4fae1c9 to cdd5c95 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/add-boto3-response-retry-error-attributes branch from cdd5c95 to d55060f 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 response, retry, and error attributes

1 participant