Skip to content

Conversation

S-Saranya1
Copy link
Contributor

@S-Saranya1 S-Saranya1 commented Aug 27, 2025

CREDENTIALS_IMDS business metric feature implementation that tracks when Instance Metadata Service (IMDS) credentials are being used in AWS SDK requests.

Motivation and Context

Adding business metric for feature ID to track IMDS (Instance Metadata Service) credential usage in AWS SDK requests this track customer adoption of the feature.

Modifications

  • Added CREDENTIALS_IMDS("0") to BusinessMetricFeatureId enum
  • Created ImdsCredentialsBusinessMetricInterceptor that detects IMDS credentials by checking if providerName contains "InstanceProfile"
  • Registered interceptor in execution.interceptors to run automatically on every SDK request
  • When IMDS credentials detected, adds metric "0" to business metrics collection, appearing as "m/0" in User-Agent headers

Testing

Added unit and integration tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@S-Saranya1 S-Saranya1 requested a review from a team as a code owner August 27, 2025 22:44
Copy link
Contributor

@L-Applin L-Applin left a comment

Choose a reason for hiding this comment

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

Is there be a way to have an integration test with a service client to test the whole request chain with the new interceptor? Maybe something similar to this?

AwsCredentials credentials = executionAttributes.getAttribute(AwsSignerExecutionAttribute.AWS_CREDENTIALS);

if (credentials != null && isImdsCredentials(credentials)) {
executionAttributes.getAttribute(SdkInternalExecutionAttribute.BUSINESS_METRICS)
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any chances getAttribute could return null?

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@S-Saranya1 S-Saranya1 closed this Sep 5, 2025
Copy link

github-actions bot commented Sep 5, 2025

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants