-
Notifications
You must be signed in to change notification settings - Fork 63
AWS SDK v2.2 SPI Patch Migration #1113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
...entelemetry/javaagent/instrumentation/awssdk_v2_2/AdotAwsSdkTracingExecutionInterceptor.java
Outdated
Show resolved
Hide resolved
...entelemetry/javaagent/instrumentation/awssdk_v2_2/AdotAwsSdkTracingExecutionInterceptor.java
Outdated
Show resolved
Hide resolved
...entelemetry/javaagent/instrumentation/awssdk_v2_2/AdotAwsSdkTracingExecutionInterceptor.java
Show resolved
Hide resolved
...entelemetry/javaagent/instrumentation/awssdk_v2_2/AdotAwsSdkTracingExecutionInterceptor.java
Show resolved
Hide resolved
I think the following links are not correct. Could you double check? =============================== |
I have updated the links, should be correct now. |
// Check if upstream aws sdk instrumentation is enabled | ||
if (!executionAttributes | ||
.toString() | ||
.contains("io.opentelemetry.javaagent.shaded.instrumentation.awssdk")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add comment to explain why this attribute is expected for a span created by upstream instrumentation? io.opentelemetry.javaagent.shaded.instrumentation.awssdk
looks like a shaded class name. Will the name be stable in future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any alternative way to check? It seems not very stable to rely on the shaded class name. It's quite easy for upstream to just use another name without knowing we are relying on the old name. The whole shading things should be transparent to business logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed offline, will check the span attributes for aws-specific attributes that should be set by upstream aws-sdk. Span interface is designed for setting attributes, not reading them (Span API). It would have been more efficient if the api allowed us to search the map, but I think the approach I suggested is a way around it
Note: This is a continuation of #1111
Description of Changes
This implementation builds on the foundation established in PR #1111, transforming the structural setup into a fully functional SPI-based solution that will replace our current patching approach. This PR does not change the current ADOT functionality because patches have not been removed.
The next/final PR for v2.2 will remove the patches for aws-sdk-2.2 and have unit tests to ensure correct SPI functionality and behaviour. The final PR will also pass all the contract-tests once patches are removed.
Changes include:
NOTE: We are not copying entire files from upstream. Instead, we only migrated the new components that were added by our patches and the methods that use these AWS-specific components. I deliberately removed any code that was untouched by our patches to avoid duplicating upstream instrumentation code. This selective migration ensures we maintain only our AWS-specific additions while letting OTel handle its base functionality.
AwsExperimentalAttributes
- patch creates new classAwsSdkRequest
- patch on this otel fileAwsSdkRequestType
- patch on this otel fileBedrockJsonParser
- patch creates new classFieldMapper
- patch on this otel fileSerializer
- patch on this otel fileBedrockJsonParserTest
- patch creates new classMethodHandleFactory
- copy-pasted from hereFieldMapping
- copy-pasted from hereAwsJsonProtocolFactoryAccess
- copy-pasted from hereThese added files:
The classes we copied from upstream are just helper utilities that make it easier to inject span attributes during instrumentation. They're not core functionality that needs to stay in sync with upstream changes, rather standalone utilities that support our simpler, independent instrumentation without creating version lock-in. They're independent of OTel's core functionality, so we don't face the same version dependency issues we had with patching. We're just following upstream's structure for consistency.
OTel attribution for copied files
The 3 coped files have the OTel header included in them. This follows section 4 a)-c) in the ADOT LICENSE
Testing
Related
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.