-
Notifications
You must be signed in to change notification settings - Fork 2.2k
mgmt, update user-agent #13085
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
mgmt, update user-agent #13085
Changes from all commits
76f0bf3
05db46a
2e33ff8
0fd94a5
912f1f7
48effdd
74dc2c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,27 +46,22 @@ public abstract class AzureServiceClient { | |
|
|
||
| private final ClientLogger logger = new ClientLogger(getClass()); | ||
|
|
||
| protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { | ||
| ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); | ||
| } | ||
|
|
||
| private static final String OS; | ||
| private static final String OS_NAME; | ||
| private static final String OS_VERSION; | ||
| private static final String JAVA_VERSION; | ||
| private static final String SDK_VERSION = "2.0.0-SNAPSHOT"; | ||
| private static final Map<String, String> PROPERTIES = | ||
| CoreUtils.getProperties("azure.properties"); | ||
|
|
||
| private static final String SDK_VERSION; | ||
| static { | ||
| OS_NAME = System.getProperty("os.name"); | ||
| OS_VERSION = System.getProperty("os.version"); | ||
| OS = OS_NAME + "/" + OS_VERSION; | ||
| String version = System.getProperty("java.version"); | ||
| JAVA_VERSION = version != null ? version : "Unknown"; | ||
| SDK_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); | ||
| } | ||
|
|
||
| private final SerializerAdapter serializerAdapter = new AzureJacksonAdapter(); | ||
|
|
||
| private String sdkName; | ||
| private final String sdkName; | ||
|
|
||
| protected AzureServiceClient(HttpPipeline httpPipeline, AzureEnvironment environment) { | ||
| sdkName = this.getClass().getPackage().getName(); | ||
| ((AzureJacksonAdapter) serializerAdapter).serializer().registerModule(DateTimeDeserializer.getModule()); | ||
| } | ||
|
|
||
| /** | ||
| * Gets serializer adapter for JSON serialization/de-serialization. | ||
|
|
@@ -83,24 +78,8 @@ public SerializerAdapter getSerializerAdapter() { | |
| * @return the default client context. | ||
| */ | ||
| public Context getContext() { | ||
| Context context = new Context("java.version", JAVA_VERSION); | ||
| if (!CoreUtils.isNullOrEmpty(OS_NAME)) { | ||
| context = context.addData("os.name", OS_NAME); | ||
| } | ||
| if (!CoreUtils.isNullOrEmpty(OS_VERSION)) { | ||
| context = context.addData("os.version", OS_VERSION); | ||
| } | ||
| if (sdkName == null) { | ||
| String packageName = this.getClass().getPackage().getName(); | ||
| if (packageName.endsWith(".models")) { | ||
| sdkName = packageName.substring(0, packageName.length() - ".models".length()); | ||
| } else { | ||
| sdkName = packageName; | ||
| } | ||
| } | ||
| context = context.addData("Sdk-Name", sdkName); | ||
| context = context.addData("Sdk-Version", SDK_VERSION); | ||
| return context; | ||
| return new Context("Sdk-Name", sdkName) | ||
| .addData("Sdk-Version", SDK_VERSION); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why sdk version hardcoded?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there might be other approach. not investigated yet.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it. let's fix it before GA.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already fixed in this PR. now the flow is:
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| version=${project.version} |
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.
Now doing this for version @yungezz