Skip to content

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

Merged
andrzej-stencel merged 26 commits intoopen-telemetry:mainfrom
mitali-salvi:feature/aws-proxy-sdk-v2-migration
Apr 15, 2026
Merged

[internal/aws/proxy] Migrate from AWS SDK v1 to v2#47244
andrzej-stencel merged 26 commits intoopen-telemetry:mainfrom
mitali-salvi:feature/aws-proxy-sdk-v2-migration

Conversation

@mitali-salvi
Copy link
Copy Markdown
Contributor

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 Signed

The committers listed above are authorized under a signed CLA.

@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!

Comment thread internal/aws/awsutil/conn_test.go
@mitali-salvi mitali-salvi force-pushed the feature/aws-proxy-sdk-v2-migration branch from 7669a9a to d22bd92 Compare March 31, 2026 20:46
@atoulme atoulme marked this pull request as draft March 31, 2026 22:07
@atoulme
Copy link
Copy Markdown
Contributor

atoulme commented Mar 31, 2026

Moving to draft while you work on this, please mark ready for review when CI passes.

@mitali-salvi mitali-salvi force-pushed the feature/aws-proxy-sdk-v2-migration branch from d22bd92 to 2dcc158 Compare April 1, 2026 19:31
@mitali-salvi mitali-salvi marked this pull request as ready for review April 1, 2026 19:32
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
Comment thread internal/aws/proxy/conn.go Outdated
Comment thread internal/aws/proxy/server.go Outdated
Comment thread internal/aws/awsutil/conn.go Outdated
- Fix misleading error message in getRegionFromMetadata: only mentions
  ECS and EC2 metadata (config/env vars are checked in resolveRegion)
- Migrate from deprecated Director to Rewrite in ReverseProxy to
  address security concern (hop-by-hop headers handled automatically)
- Unexport GetProxyAddress and GetProxyURL since they are not used
  outside the awsutil package
Comment thread .sisyphus/handoff/no-proxy-regression-analysis.md Outdated
Comment thread internal/aws/awsutil/conn.go Outdated
Comment thread internal/aws/proxy/server.go Outdated
Comment thread internal/aws/proxy/server.go Outdated
Also address round 2 review feedback from Aneurysm9:
- Delete unused getProxyAddress/getProxyURL and their tests (dead code)
- Simplify Rewrite comment (Director deprecation detail in commit history)
- Read from r.In.Body instead of r.Out.Body for hash computation
@mitali-salvi mitali-salvi force-pushed the feature/aws-proxy-sdk-v2-migration branch from 0cb0ee1 to c35f9bc Compare April 9, 2026 18:46
@apatniv
Copy link
Copy Markdown

apatniv commented Apr 12, 2026

@mitali-salvi Hey, I was looking at issue #37728. Do you intend to migrate all AWS use cases from v1 to v2? If yes, then I would pick up another issue to work on. Thanks.

@mitali-salvi
Copy link
Copy Markdown
Contributor Author

@atoulme should be ready to review now

@mitali-salvi
Copy link
Copy Markdown
Contributor Author

@andrzej-stencel I would appreciate a review as well :)

@paulojmdias
Copy link
Copy Markdown
Member

/workflow-approve

@paulojmdias
Copy link
Copy Markdown
Member

/workflow-approve

Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

🎉

@mitali-salvi
Copy link
Copy Markdown
Contributor Author

@codeboten can I get this PR merged please ? :)

@andrzej-stencel andrzej-stencel merged commit 90219fd into open-telemetry:main Apr 15, 2026
191 checks passed
@otelbot
Copy link
Copy Markdown
Contributor

otelbot bot commented Apr 15, 2026

Thank you for your contribution @mitali-salvi! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help.

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

10 participants