feat(boto3): Add common OTel AWS client attributes - #7481
pabloDeputter merged 6 commits into
Conversation
Codecov Results 📊✅ 132565 passed | ⏭️ 7220 skipped | Total: 139785 | Pass Rate: 94.83% | Execution Time: 446m 31s 📊 Comparison with Base Branch
➖ Removed Tests (60)View removed tests
All tests are passing successfully. ✅ Patch coverage is 92.98%. Project has 2561 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## master #PR +/-##
==========================================
+ Coverage 90.30% 90.32% +0.02%
==========================================
Files 195 199 +4
Lines 26261 26469 +208
Branches 9798 9846 +48
==========================================
+ Hits 23714 23908 +194
- Misses 2547 2561 +14
- Partials 1485 1493 +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
ddf5deb to
351e3b6
Compare
3412f9b to
64d7159
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.
Reviewed by Cursor Bugbot for commit 64d7159. Configure here.
1824d8f to
3d95ef4
Compare
3d95ef4 to
f3ed486
Compare
| ) -> "Attributes": | ||
| attributes: "Attributes" = {} | ||
|
|
||
| # `rpc.service` is deprecated in OTel, but js still uses it. |
There was a problem hiding this comment.
They likely still use it because it's listed as a valid attribute in our conventions.
Not something for this pull request, but it might be worth raising this in our Slack channel for the conventions to see if this is something that we should look to deprecate as well.
There was a problem hiding this comment.
I was gonna make a collection of all new attributes that will be added during this project (including all the service-specific as well) to check which ones contain sensitive data and whether they already map to existing data collection categories. So I'll add rpc.service to that document as well.
| assert span["name" if span_streaming else "description"] == span_name | ||
| assert attributes[SPANDATA.RPC_SERVICE] == rpc_service | ||
| assert attributes[SPANDATA.RPC_METHOD] == rpc_method | ||
| assert attributes[SPANDATA.RPC_SYSTEM_NAME] == "aws-api" |
There was a problem hiding this comment.
A small nitpick here (feel free to ignore): you could update the hard-coded string here to be the constant that you created in the other file.
| assert attributes[SPANDATA.RPC_SYSTEM_NAME] == "aws-api" | |
| assert attributes[SPANDATA.RPC_SYSTEM_NAME] == _AWS_RPC_SYSTEM_NAME |
There was a problem hiding this comment.
Yupp, I'll move that to consts.py as well
| if span_streaming: | ||
| _assert_one_failed_span(client_spans, span_streaming=True) |
There was a problem hiding this comment.
Small cleanup suggestion: you could remove this conditional and the extra line inside the block by assigning the span_streaming variable to equal span_streaming:
| if span_streaming: | |
| _assert_one_failed_span(client_spans, span_streaming=True) | |
| if span_streaming: | |
| _assert_one_failed_span(client_spans, span_streaming=span_streaming) |
4562898 to
dca0a7b
Compare
dca0a7b to
4a23000
Compare
4a23000 to
8b758b2
Compare
8b758b2 to
6868ffd
Compare



Description
Implements #7475 by adding common OTel attributes to boto client spans.
Changes
rpc.system.name,rpc.service,rpc.method,cloud.region,server.address,server.port.rpc.system.nametoaws-apiService.Operation(now it'saws.<service>.<Operation>), e.g.S3.HeadObjectfollowing OTel is a breaking change and will be done in major.rpc.service; not supported anymore by OTel, but JS keeps this too.rpc.method.AwsCallContextto carry extra client metadata for instrumentation.Issues
Resolves #7475