-
Notifications
You must be signed in to change notification settings - Fork 858
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
Adds the user agent appId metadata tag #5636
base: master
Are you sure you want to change the base?
Conversation
...k-core/src/main/java/software/amazon/awssdk/core/client/builder/SdkDefaultClientBuilder.java
Outdated
Show resolved
Hide resolved
...k-core/src/main/java/software/amazon/awssdk/core/internal/useragent/SdkUserAgentBuilder.java
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
* This configuration option supersedes {@link SdkAdvancedClientOption#USER_AGENT_PREFIX} and | ||
* {@link SdkAdvancedClientOption#USER_AGENT_SUFFIX} and should be used instead of those options. | ||
*/ | ||
default B appId(String appId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add this to ClientOverrideConfiguration instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
...k-core/src/main/java/software/amazon/awssdk/core/client/builder/SdkDefaultClientBuilder.java
Outdated
Show resolved
Hide resolved
private Supplier<ProfileFile> profileFile; | ||
private String profileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're not final
@@ -124,4 +134,12 @@ private static void appendAdditionalJvmMetadata(StringBuilder builder, SystemUse | |||
appendNonEmptyField(builder, METADATA, lang); | |||
} | |||
} | |||
|
|||
private static void checkLengthAndWarn(String appId) { | |||
if (appId.length() > 50) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check, is this only logged once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's only logged once.
Motivation and Context
AWS SDKs have added the
appId
metadata tag which allows users to set an identifier for their application that is added to the user agent string for every request. This PR adds the feature to the AWS SDK for Java v2.Modifications
appId
as a client param inSdkDefaultClientBuilder
appId
in environment variables, system settings and config files, and a resolver for determining if any such system value exists.Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License