Skip to content

Commit 24a96af

Browse files
committed
chore: Remove dependency from exporter-metrics
1 parent b444ec3 commit 24a96af

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

  • java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/TelemetryUtils.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public static void recordOperationMetrics(
7373
Stopwatch operationStopwatch,
7474
String methodName,
7575
String status) {
76-
if (methodName != null) {
76+
if (methodName != null
77+
&& !TelemetryConstants.Transport.GRPC.getTransport()
78+
.equals(TelemetryConstants.getTransportName(datastoreOptions.getTransportOptions()))) {
7779
Map<String, String> attributes = buildMetricAttributes(datastoreOptions, methodName, status);
7880
metricsRecorder.recordOperationLatency(
7981
operationStopwatch.elapsed(TimeUnit.MILLISECONDS), attributes);
@@ -108,10 +110,14 @@ public static <T> Callable<T> attemptMetricsCallable(
108110
status = DatastoreException.extractStatusCode(e);
109111
throw e;
110112
} finally {
111-
Map<String, String> attributes =
112-
buildMetricAttributes(datastoreOptions, methodName, status);
113-
metricsRecorder.recordAttemptLatency(stopwatch.elapsed(TimeUnit.MILLISECONDS), attributes);
114-
metricsRecorder.recordAttemptCount(1, attributes);
113+
if (!TelemetryConstants.Transport.GRPC.getTransport()
114+
.equals(TelemetryConstants.getTransportName(datastoreOptions.getTransportOptions()))) {
115+
Map<String, String> attributes =
116+
buildMetricAttributes(datastoreOptions, methodName, status);
117+
metricsRecorder.recordAttemptLatency(
118+
stopwatch.elapsed(TimeUnit.MILLISECONDS), attributes);
119+
metricsRecorder.recordAttemptCount(1, attributes);
120+
}
115121
}
116122
};
117123
}

0 commit comments

Comments
 (0)