From 969f197e6f9e2fe39c567c97f2419dab4eed2eba Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Mon, 7 Oct 2024 17:38:35 -0400 Subject: [PATCH] update --- .../bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java index 954bd61825..7a3f54913e 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java @@ -84,6 +84,7 @@ class BuiltinMetricsTracer extends BigtableTracer { private final Attributes baseAttributes; private Long serverLatencies = null; + private final AtomicLong grpcMessageSentDelay = new AtomicLong(0); // OpenCensus (and server) histogram buckets use [start, end), however OpenTelemetry uses (start, // end]. To work around this, we measure all the latencies in nanoseconds and convert them @@ -264,7 +265,7 @@ public void batchRequestThrottled(long throttledTimeNanos) { @Override public void grpcMessageSent() { - totalClientBlockingTime.addAndGet(attemptTimer.elapsed(TimeUnit.NANOSECONDS)); + grpcMessageSentDelay.set(attemptTimer.elapsed(TimeUnit.NANOSECONDS)); } @Override @@ -351,6 +352,7 @@ private void recordAttemptCompletion(@Nullable Throwable status) { .put(STATUS_KEY, statusStr) .build(); + totalClientBlockingTime.addAndGet(grpcMessageSentDelay.get()); clientBlockingLatenciesHistogram.record(convertToMs(totalClientBlockingTime.get()), attributes); attemptLatenciesHistogram.record(