retrying =
- Callables.retrying(withHeaderTracer, settings.readModifyWriteRowSettings(), clientContext);
+ Callables.retrying(
+ withBigtableTracer, settings.readModifyWriteRowSettings(), clientContext);
return createUserFacingUnaryCallable(
methodName, new ReadModifyWriteRowCallable(retrying, requestContext));
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerStreamingCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerStreamingCallable.java
similarity index 85%
rename from google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerStreamingCallable.java
rename to google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerStreamingCallable.java
index f73511dc4c71..09bb906a89d0 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerStreamingCallable.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerStreamingCallable.java
@@ -28,26 +28,26 @@
import javax.annotation.Nonnull;
/**
- * This callable will inject a {@link GrpcResponseMetadata} to access the headers and trailers
- * returned by gRPC methods upon completion. The {@link BigtableTracer} will process metrics that
- * were injected in the header/trailer and publish them to OpenCensus. If {@link
- * GrpcResponseMetadata#getMetadata()} returned null, it probably means that the request has never
- * reached GFE, and it'll increment the gfe_header_missing_counter in this case.
+ * This callable will
*
- * If GFE metrics are not registered in {@link RpcViews}, skip injecting GrpcResponseMetadata.
- * This is for the case where direct path is enabled, all the requests won't go through GFE and
- * therefore won't have the server-timing header.
+ *
-inject a {@link GrpcResponseMetadata} to access the headers and trailers returned by gRPC
+ * methods upon completion. The {@link BigtableTracer} will process metrics that were injected in
+ * the header/trailer and publish them to OpenCensus. If {@link GrpcResponseMetadata#getMetadata()}
+ * returned null, it probably means that the request has never reached GFE, and it'll increment the
+ * gfe_header_missing_counter in this case.
+ *
+ *
-Call {@link BigtableTracer#onRequest()} to record the request events in a stream.
*
*
This class is considered an internal implementation detail and not meant to be used by
* applications.
*/
@InternalApi
-public class HeaderTracerStreamingCallable
+public class BigtableTracerStreamingCallable
extends ServerStreamingCallable {
private final ServerStreamingCallable innerCallable;
- public HeaderTracerStreamingCallable(
+ public BigtableTracerStreamingCallable(
@Nonnull ServerStreamingCallable callable) {
this.innerCallable = Preconditions.checkNotNull(callable, "Inner callable must be set");
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerUnaryCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerUnaryCallable.java
similarity index 89%
rename from google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerUnaryCallable.java
rename to google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerUnaryCallable.java
index adbb6c84a9be..fd2eb60f272f 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerUnaryCallable.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerUnaryCallable.java
@@ -34,20 +34,16 @@
* GrpcResponseMetadata#getMetadata()} returned null, it probably means that the request has never
* reached GFE, and it'll increment the gfe_header_missing_counter in this case.
*
- * If GFE metrics are not registered in {@link RpcViews}, skip injecting GrpcResponseMetadata.
- * This is for the case where direct path is enabled, all the requests won't go through GFE and
- * therefore won't have the server-timing header.
- *
*
This class is considered an internal implementation detail and not meant to be used by
* applications.
*/
@InternalApi
-public class HeaderTracerUnaryCallable
+public class BigtableTracerUnaryCallable
extends UnaryCallable {
private final UnaryCallable innerCallable;
- public HeaderTracerUnaryCallable(@Nonnull UnaryCallable innerCallable) {
+ public BigtableTracerUnaryCallable(@Nonnull UnaryCallable innerCallable) {
this.innerCallable = Preconditions.checkNotNull(innerCallable, "Inner callable must be set");
}
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerCallableTest.java
similarity index 99%
rename from google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerCallableTest.java
rename to google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerCallableTest.java
index d93859bbadef..1b833f5c0639 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/HeaderTracerCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerCallableTest.java
@@ -68,7 +68,7 @@
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
-public class HeaderTracerCallableTest {
+public class BigtableTracerCallableTest {
private Server server;
private Server serverNoHeader;
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 a48df9225447..9294033f2651 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
@@ -307,7 +307,10 @@ public void testRetryCount() {
stub.mutateRowCallable()
.call(RowMutation.create(TABLE_ID, "random-row").setCell("cf", "q", "value"));
- verify(statsRecorderWrapper).putRetryCount(retryCount.capture());
+ // onOperationComplete() is called in TracerFinisher which will be called after the mutateRow
+ // call is returned. So there's a race between when the call returns and when the putRetryCount
+ // is called in onOperationCompletion().
+ verify(statsRecorderWrapper, timeout(20)).putRetryCount(retryCount.capture());
assertThat(retryCount.getValue()).isEqualTo(fakeService.getAttemptCounter().get() - 1);
}
@@ -328,7 +331,7 @@ public void testMutateRowAttempts() {
// calls releaseWaiters(). onOperationComplete() is called in TracerFinisher which will be
// called after the mutateRow call is returned. So there's a race between when the call returns
// and when the record() is called in onOperationCompletion().
- verify(statsRecorderWrapper, timeout(10).times(fakeService.getAttemptCounter().get() + 1))
+ verify(statsRecorderWrapper, timeout(20).times(fakeService.getAttemptCounter().get() + 1))
.record(status.capture(), tableId.capture(), zone.capture(), cluster.capture());
assertThat(zone.getAllValues()).containsExactly(UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED);
assertThat(cluster.getAllValues()).containsExactly(UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED);