Skip to content

[internal/aws/proxy] Migrate from AWS SDK v1 to v2#47244

Open
mitali-salvi wants to merge 11 commits intoopen-telemetry:mainfrom
mitali-salvi:feature/aws-proxy-sdk-v2-migration
Open

[internal/aws/proxy] Migrate from AWS SDK v1 to v2#47244
mitali-salvi wants to merge 11 commits intoopen-telemetry:mainfrom
mitali-salvi:feature/aws-proxy-sdk-v2-migration

Conversation

@mitali-salvi
Copy link
Copy Markdown

Migrates internal/aws/proxy from AWS SDK Go v1 to v2.

Link to tracking issue

Fixes #40461
Related: #37728

Testing

  • TestHandlerSignerErrorsOut: PASS
  • Full internal/aws/proxy test suite: PASS
  • All 4 affected modules (internal/aws/proxy, internal/aws/awsutil, extension/awsproxy, receiver/awsxrayreceiver): build PASS, tests PASS

Documentation

No documentation changes needed — test-only fix.

@mitali-salvi mitali-salvi requested a review from a team as a code owner March 30, 2026 20:16
@mitali-salvi mitali-salvi requested a review from mwear March 30, 2026 20:16
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 30, 2026

CLA Not Signed

@github-actions github-actions bot added the first-time contributor PRs made by new contributors label Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

seongpil0948 and others added 11 commits March 30, 2026 20:38
This change migrates the internal AWS proxy module from AWS SDK Go v1
to v2, removing dependency on the deprecated AWS SDK v1.

Fixes open-telemetry#40461
Extract region detection from getAWSConfigSession into smaller,
focused functions for better readability and maintainability.
- Remove unused `implicitGlobalRegion` field from partitionConfig struct
- Remove unused `getServiceEndpointFromConfig` function
- Fix errorlint: use %w for error wrapping in fmt.Errorf
- Fix unused-parameter: rename unused ctx parameters to _
- Fix usetesting: replace context.Background() with t.Context()
…d consolidate proxy functions

- Convert getRegionFromEC2Metadata to mockable function variable to prevent
  real HTTP calls to EC2 IMDS (169.254.169.254) during tests
- Export GetProxyAddress and GetProxyURL from awsutil package
- Remove duplicate getProxyAddress/getProxyURL from proxy package
- Remove hand-rolled partition table; use sts.NewDefaultEndpointResolverV2()
  for getServiceEndpoint covering all 8 AWS partitions
- Remove duplicate cfg.RetryMaxAttempts and redundant cfg.Region assignment
- Replace getPrimaryRegion with prefix-based matching for all partitions
- Refactor setupMock to use t.Cleanup() with meaningful variable names
- Fix data race in signing tests: use buffered channels + r.Clone()
- Replace silent nil-guards with require.NotNil/require.NotEmpty
- Expand TestGetServiceEndpoint with iso/isob/isoe/isof/eusc partitions
- Remove TestLoadEnvConfigCreds (covered by awsutil package tests)

Assisted-by: Claude Opus 4
The test relied on SDK v1 behavior where credentials.Retrieve() would
fail with 'no EC2 IMDS role found' when no credentials were configured.
SDK v2's default credential chain does not immediately fail in this
scenario. Fix by injecting a mock CredentialsProvider that returns a
deterministic error.
@mitali-salvi mitali-salvi force-pushed the feature/aws-proxy-sdk-v2-migration branch from 5b6a59d to 2d9fc25 Compare March 30, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[extension/awsproxy] migrate to AWS v2 SDK

3 participants