From 8a2aa0eb4889a0f7f103c003a6c71b5d854cbf5c Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Mon, 23 May 2022 20:17:58 -0700 Subject: [PATCH] remove unary application latency streaming tag --- .../v2/stub/metrics/BuiltinMetricsTracer.java | 2 +- .../stub/metrics/BuiltinMetricsTracerTest.java | 17 ----------------- 2 files changed, 1 insertion(+), 18 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 d87d0ffc6a..09e68c1982 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 @@ -221,13 +221,13 @@ private void recordOperationCompletion(@Nullable Throwable status) { applicationLatencyTimer.stop(); totalApplicationLatency.addAndGet(applicationLatencyTimer.elapsed(TimeUnit.MILLISECONDS)); } - recorder.recordApplicationLatency(totalApplicationLatency.get(), tableId, zone, cluster); recorder.recordOperationLatencies(operationTimer.elapsed(TimeUnit.MILLISECONDS)); if (operationType == ApiTracerFactory.OperationType.ServerStreaming && spanName.getMethodName().equals("ReadRows")) { recorder.recordFirstResponseLatency(firstResponsePerOpTimer.elapsed(TimeUnit.MILLISECONDS)); + recorder.recordApplicationLatency(totalApplicationLatency.get(), tableId, zone, cluster); } recorder.recordOperationLevelWithoutStreaming( diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java index 06e756ba5a..e2f776529c 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java @@ -308,23 +308,6 @@ public void onComplete() { assertThat(longValue.getValue()).isLessThan(applicationLatency * (counter.get() + 1)); } - @Test - public void testMutateRowApplicationLatency() { - // Unary callable application latency is the delay between retries - stub.mutateRowCallable() - .call(RowMutation.create(TABLE_ID, "random-row").setCell("cf", "q", "value")); - - verify(builtinMetricsRecorder) - .recordApplicationLatency( - longValue.capture(), tableId.capture(), zone.capture(), cluster.capture()); - - // Application latency should be slightly less than the total delay between 2 requests observed - // from the server side. To make - // the test less flaky comparing with half of the server side delay here. - assertThat(longValue.getValue()).isAtLeast(serverTotalRetryDelay.get() / 2); - assertThat(longValue.getValue()).isAtMost(serverTotalRetryDelay.get()); - } - @Test public void testRetryCount() { stub.mutateRowCallable()