Skip to content

Base of AWS SDK v1.11 SPI Implementation #1115

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

Merged
merged 6 commits into from
Jul 17, 2025

Conversation

anahatAWS
Copy link
Contributor

This PR is similar to #1111, as it sets a base SPI implementation for AWS SDK v1.11.

Issue

This is the skeleton set up for the SPI, which aims to remove the patch for aws-sdk v1.11 by using OTel's InstrumentationModule SPI extension. This instrumentation is essentially complementing the upstream java agent. It is completely separate from upstream and instruments after the Otel agent.

Description of Changes

This PR sets up the foundational structure for AWS SDK v1.11 Instrumentation, moving away from the current patching approach. It doesn't modify current ADOT functionality or the upstream span. It just registers the ADOT SPI implementation and sets up the interceptor hooks.

Core Components

  1. AdotAwsSdkInstrumentationModule

    • Extends OpenTelemetry's InstrumentationModule SPI
    • Registers custom handler through AdotAwsSdkClientInstrumentation class in typeInstrumentations method
  2. AdotAwsSdkClientInstrumentation

    • AdotAwsSdkClientAdvice registers our handler only if the upstream aws-sdk span is enabled (i.e. it checks if the upstream handler is present when an AWS SDK client is initialized).
  3. AdotAwsSdkTracingRequestHandler

    • Extends AWS SDK's RequestHandler2
    • Hooks into key SDK lifecycle points:
      • beforeRequest: Captures final SDK request after upstream modifications
      • afterAttempt: Processes response before span closure in upstream
    • Will be used to enriches spans
    • Acts as central coordinator for all the awssdk_v1_11 components
  4. Resources Folder

    • Registers the v1.11 AdotAwsSdkInstrumentationModule into OTel's SPI extension classpath in META-INF/services

Key Design Decisions

  1. Instrumentation Ordering

    • Deliberately structured to run after upstream OTel agent
    • Ensures all upstream modifications are captured
    • Maintains compatibility with existing instrumentation
  2. Lifecycle Hook Points

    • beforeRequest: Last point to access modified request
    • afterAttempt: Final opportunity to enrich span before closure

Testing

  • Verified existing functionality remains unchanged and contract tests pass (all contract tests pass after following the steps here)
  • Confirmed build success with new structure

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@anahatAWS anahatAWS requested a review from a team as a code owner July 14, 2025 17:51
pxaws
pxaws previously approved these changes Jul 15, 2025
Copy link
Contributor

@thpierce thpierce left a comment

Choose a reason for hiding this comment

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

I don't see any unit tests, and I'm realizing we didn't have any unit tests in the V2 impl either. Why do you think we don't need unit tests?

@thpierce thpierce merged commit ac3c0c7 into aws-observability:main Jul 17, 2025
5 checks passed
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.

3 participants