Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Nov 18, 2021
1 parent 2026495 commit 2516635
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
Expand Up @@ -465,7 +465,7 @@ private <RowT> UnaryCallable<Query, List<RowT>> createBulkReadRowsCallable(
new TracedBatcherUnaryCallable<>(readRowsUserCallable.all());

UnaryCallable<Query, List<RowT>> withHeaderTracer =
new HeaderTracerUnaryCallable(tracedBatcher);
new HeaderTracerUnaryCallable(tracedBatcher);

UnaryCallable<Query, List<RowT>> traced =
new TracedUnaryCallable<>(withHeaderTracer, clientContext.getTracerFactory(), span);
Expand Down Expand Up @@ -596,7 +596,7 @@ private UnaryCallable<BulkMutation, Void> createBulkMutateRowsCallable() {
UnaryCallable<BulkMutation, Void> tracedBatcher = new TracedBatcherUnaryCallable<>(userFacing);

UnaryCallable<BulkMutation, Void> withHeaderTracer =
new HeaderTracerUnaryCallable<>(tracedBatcher);
new HeaderTracerUnaryCallable<>(tracedBatcher);

UnaryCallable<BulkMutation, Void> traced =
new TracedUnaryCallable<>(withHeaderTracer, clientContext.getTracerFactory(), spanName);
Expand Down
Expand Up @@ -182,7 +182,7 @@ public void recordGfeMetadata(@Nullable Long latency) {
@Override
public void batchRequestThrottled(long throttledTimeMs) {
for (BigtableTracer tracer : bigtableTracers) {
tracer.batchRequestThrottled(throttledTimeMs);
tracer.batchRequestThrottled(throttledTimeMs);
}
}
}
Expand Up @@ -215,8 +215,8 @@ public void recordGfeMetadata(@Nullable Long latency) {
MeasureMap measures = stats.newMeasureMap();
if (latency != null) {
measures
.put(RpcMeasureConstants.BIGTABLE_GFE_LATENCY, latency)
.put(RpcMeasureConstants.BIGTABLE_GFE_HEADER_MISSING_COUNT, 0L);
.put(RpcMeasureConstants.BIGTABLE_GFE_LATENCY, latency)
.put(RpcMeasureConstants.BIGTABLE_GFE_HEADER_MISSING_COUNT, 0L);
} else {
measures.put(RpcMeasureConstants.BIGTABLE_GFE_HEADER_MISSING_COUNT, 1L);
}
Expand Down
Expand Up @@ -39,6 +39,7 @@ public TracedBatcherUnaryCallable(UnaryCallable innerCallable) {
public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext context) {
if (context.getOption(Batcher.THROTTLED_TIME_KEY) != null) {
ApiTracer tracer = context.getTracer();
// this should always be true
if (tracer instanceof BigtableTracer) {
((BigtableTracer) tracer)
.batchRequestThrottled(context.getOption(Batcher.THROTTLED_TIME_KEY));
Expand Down
Expand Up @@ -29,7 +29,6 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcCallContext;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.FixedTransportChannelProvider;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.auth.oauth2.ServiceAccountJwtAccessCredentials;
Expand Down Expand Up @@ -440,7 +439,6 @@ public void testCallContextPropagatedInMutationBatcher()
.setPrimedTableIds("table1", "table2")
.build();

ClientContext context = ClientContext.create(settings);
try (EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings)) {
// clear the previous contexts
contextInterceptor.contexts.clear();
Expand Down

0 comments on commit 2516635

Please sign in to comment.