[internal/aws/proxy] Migrate from AWS SDK v1 to v2#47244
Open
mitali-salvi wants to merge 11 commits intoopen-telemetry:mainfrom
Open
[internal/aws/proxy] Migrate from AWS SDK v1 to v2#47244mitali-salvi wants to merge 11 commits intoopen-telemetry:mainfrom
mitali-salvi wants to merge 11 commits intoopen-telemetry:mainfrom
Conversation
|
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! |
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.
5b6a59d to
2d9fc25
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates internal/aws/proxy from AWS SDK Go v1 to v2.
Link to tracking issue
Fixes #40461
Related: #37728
Testing
Documentation
No documentation changes needed — test-only fix.