feat(boto3): trace logical AWS calls with common attributes - #7481
pabloDeputter wants to merge 34 commits into
Conversation
Codecov Results 📊✅ 128609 passed | ⏭️ 7151 skipped | Total: 135760 | Pass Rate: 94.73% | Execution Time: 435m 12s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 92.55%. Project has 2541 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## master #PR +/-##
==========================================
+ Coverage 90.17% 90.21% +0.04%
==========================================
Files 193 196 +3
Lines 25773 25962 +189
Branches 9532 9582 +50
==========================================
+ Hits 23241 23421 +180
- Misses 2532 2541 +9
- Partials 1431 1439 +8Generated by Codecov Action |
9fe9acf to
4e8f427
Compare
| except BaseException as exc: | ||
| if span is not None: | ||
| with capture_internal_exceptions(): | ||
| _finish_active_http_child_span(span) |
There was a problem hiding this comment.
Why are we ending the stdlib span here?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I can send a screenshot from sentry maybe to show against latest release
aa1d65a to
939a3f8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 12e4678. Configure here.
50bb86d to
ddf5deb
Compare
- wrapper owns a single botocore client-call lifecycle. - introduce service-extension architecture. - add generic response, retry, and error attributes. - add common attributes that are the same across services.
…an naming and `rpc.service` and `parse_url` patch target
…st.resend_count`
…er attributes; remove direct testing of `_get_server_attributes`
…>`, e.g. `aws.s3.GetObject`
…ration in correct order
…o3 integration in correct order"
ddf5deb to
351e3b6
Compare



Description
Implements #7474 and #7475 by moving boto3 instrumentation from individual HTTP request attempts to botocore client-call lifecycle and adding some common OTel AWS attributes.
Previously, the client span was created from the botocore
request-createdevent; since botocore creates a newAwsRequestevent for every retry, these spans represent individual retries rather than the full event. Following OTel (https://opentelemetry.io/docs/specs/semconv/rpc/rpc-spans/#rpc-client-span) the span should cover the entire call lifecycle including all retries. Wrapping_make_api_call()covers all retries performed by botocore, including serialization, endpoint resolution, the final response or failures (https://github.com/boto/botocore/blob/develop/botocore/client.py:999).Changes
BaseClient._make_api_call()is patched such that one span is created for one boto3 operation; this span is kept active across every retry.AwsCallContextclass is added containing service, operation, region, etc for a a single call.request-createdis kept for breadcrumbs and HTTP attributes.Boto3Integrationis still unchanged, test was also added for this atboto3/test_client.py:20.Service.Operation, e.g.S3.HeadObjectfollowing OTel.rpc.system.name,rpc.service,rpc.method,cloud.region,server.address,server.port.Issues
Resolves #7474 & #7475