|
18 | 18 |
|
19 | 19 | import static com.google.cloud.opentelemetry.detection.GCPPlatformDetector.SupportedPlatform.GOOGLE_KUBERNETES_ENGINE; |
20 | 20 | import static com.google.cloud.spanner.BuiltInMetricsConstant.CLIENT_HASH_KEY; |
| 21 | +import static com.google.cloud.spanner.BuiltInMetricsConstant.CLIENT_NAME_KEY; |
21 | 22 | import static com.google.cloud.spanner.BuiltInMetricsConstant.CLIENT_UID_KEY; |
22 | 23 | import static com.google.cloud.spanner.BuiltInMetricsConstant.INSTANCE_CONFIG_ID_KEY; |
23 | 24 | import static com.google.cloud.spanner.BuiltInMetricsConstant.INSTANCE_ID_KEY; |
|
26 | 27 | import static com.google.cloud.spanner.BuiltInMetricsConstant.SPANNER_RESOURCE_TYPE; |
27 | 28 |
|
28 | 29 | import com.google.api.core.ApiFunction; |
| 30 | +import com.google.api.gax.core.GaxProperties; |
29 | 31 | import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; |
30 | 32 | import com.google.auth.Credentials; |
31 | 33 | import com.google.cloud.opentelemetry.detection.AttributeKeys; |
@@ -75,6 +77,9 @@ OpenTelemetry getOrCreateOpenTelemetry( |
75 | 77 | try { |
76 | 78 | if (this.openTelemetry == null) { |
77 | 79 | SdkMeterProviderBuilder sdkMeterProviderBuilder = SdkMeterProvider.builder(); |
| 80 | + // BuiltInMetricsView.registerBuiltinMetrics( |
| 81 | + // SpannerCloudMonitoringExporter.create(projectId, credentials, monitoringHost), |
| 82 | + // sdkMeterProviderBuilder); |
78 | 83 |
|
79 | 84 | // Use GoogleCloudMetricExporter with service time series as the current custom exporter |
80 | 85 | // does not export exemplars |
@@ -153,8 +158,9 @@ Attributes createResourceAttributes(String projectId) { |
153 | 158 |
|
154 | 159 | Map<String, String> createClientAttributes() { |
155 | 160 | Map<String, String> clientAttributes = new HashMap<>(); |
156 | | - String clientUid = getDefaultTaskValue(); |
157 | | - clientAttributes.put(CLIENT_UID_KEY.getKey(), clientUid); |
| 161 | + clientAttributes.put( |
| 162 | + CLIENT_NAME_KEY.getKey(), "spanner-java/" + GaxProperties.getLibraryVersion(getClass())); |
| 163 | + clientAttributes.put(CLIENT_UID_KEY.getKey(), getDefaultTaskValue()); |
158 | 164 | return clientAttributes; |
159 | 165 | } |
160 | 166 |
|
|
0 commit comments