From 445a66737b45835444b26261b6f017f7fc278f45 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Tue, 1 Nov 2022 12:19:45 -0400 Subject: [PATCH] fix: only record retry count when it's > 0 (#1488) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: only record retry count when it's > 0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java | 6 +++++- .../google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) 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 4704f04a4d..d02cf99f0d 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 @@ -232,7 +232,11 @@ private void recordOperationCompletion(@Nullable Throwable status) { operationTimer.stop(); long operationLatency = operationTimer.elapsed(TimeUnit.MILLISECONDS); - recorder.putRetryCount(attemptCount - 1); + // Only record when retry count is greater than 0 so the retry + // graph will be less confusing + if (attemptCount > 1) { + recorder.putRetryCount(attemptCount - 1); + } // serverLatencyTimer should already be stopped in recordAttemptCompletion recorder.putOperationLatencies(operationLatency); diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java index 34201d961a..e55f3a160d 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java @@ -48,7 +48,6 @@ public class BuiltinMetricsIT { public static String[] VIEWS = { "operation_latencies", - "retry_count", "attempt_latencies", "connectivity_error_count", "application_blocking_latencies"