|
13 | 13 | public final class VersionGenerator { |
14 | 14 | private static final String UNKNOWN_VERSION_VALUE = "unknown"; |
15 | 15 |
|
16 | | - private static final String artifactName; |
17 | | - private static final String artifactVersion; |
18 | | - |
19 | 16 | private static final String sdkVersionString; |
20 | 17 |
|
21 | 18 | static { |
22 | | - Map<String, String> properties |
23 | | - = CoreUtils.getProperties("azure-monitor-opentelemetry-autoconfigure.properties"); |
| 19 | + String componentName = null; |
| 20 | + String componentVersion = null; |
| 21 | + |
| 22 | + Map<String, String> springDistroProperties |
| 23 | + = CoreUtils.getProperties("azure-spring-cloud-azure-starter-monitor.properties"); |
| 24 | + String springDistroVersion = springDistroProperties.get("version"); |
| 25 | + if(springDistroVersion != null) { |
| 26 | + componentName = "dss"; |
| 27 | + componentVersion = springDistroVersion; |
| 28 | + } |
| 29 | + |
| 30 | + Map<String, String> quarkusProperties |
| 31 | + = CoreUtils.getProperties("quarkus-exporter.properties"); |
| 32 | + String quarkusVersion = quarkusProperties.get("version"); |
| 33 | + if(quarkusVersion != null) { |
| 34 | + componentName = "dsq"; |
| 35 | + componentVersion = quarkusVersion; |
| 36 | + } |
24 | 37 |
|
25 | | - artifactName = properties.get("name"); |
26 | | - artifactVersion = properties.get("version"); |
| 38 | + if(componentName == null) { |
| 39 | + componentName = "ext"; |
| 40 | + Map<String, String> otelAutoconfigureProperties |
| 41 | + = CoreUtils.getProperties("azure-monitor-opentelemetry-autoconfigure.properties"); |
| 42 | + componentVersion = otelAutoconfigureProperties.get("version"); |
| 43 | + } |
27 | 44 |
|
28 | 45 | sdkVersionString = getPrefix() + "java" + getJavaVersion() + getJavaRuntime() + ":" + "otel" |
29 | | - + getOpenTelemetryApiVersion() + ":" + "ext" + artifactVersion; |
| 46 | + + getOpenTelemetryApiVersion() + ":" + componentName + componentVersion; |
30 | 47 | } |
31 | 48 |
|
32 | 49 | private static String getPrefix() { |
@@ -56,24 +73,6 @@ private static String getOs() { |
56 | 73 | return "u"; |
57 | 74 | } |
58 | 75 |
|
59 | | - /** |
60 | | - * This method returns artifact name. |
61 | | - * |
62 | | - * @return artifactName. |
63 | | - */ |
64 | | - public static String getArtifactName() { |
65 | | - return artifactName; |
66 | | - } |
67 | | - |
68 | | - /** |
69 | | - * This method returns artifact version. |
70 | | - * |
71 | | - * @return artifactVersion. |
72 | | - */ |
73 | | - public static String getArtifactVersion() { |
74 | | - return artifactVersion; |
75 | | - } |
76 | | - |
77 | 76 | /** |
78 | 77 | * This method returns sdk version string as per the below format javaX:otelY:extZ X = Java |
79 | 78 | * version, Y = opentelemetry version, Z = exporter version |
|
0 commit comments