From 8579ac1bd646991f1f164d6ab6c747c3b43032b5 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Thu, 21 Feb 2019 17:04:13 -0500 Subject: [PATCH] format --- .../data/v2/stub/EnhancedBigtableStub.java | 70 +++++++++++-------- .../v2/stub/EnhancedBigtableStubSettings.java | 16 ++--- .../gaxx/tracing/WrappedTracerFactory.java | 2 - 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java index 41041593ccda..a587fe2ed788 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java @@ -101,7 +101,8 @@ public static EnhancedBigtableStub create(EnhancedBigtableStubSettings settings) .setStreamWatchdogProvider(settings.getStreamWatchdogProvider()) .setStreamWatchdogCheckInterval(settings.getStreamWatchdogCheckInterval()) // Force the base stub to use a different TracerFactory - .setTracerFactory(new WrappedTracerFactory(settings.getTracerFactory(), TRACING_INNER_CLIENT_NAME)); + .setTracerFactory( + new WrappedTracerFactory(settings.getTracerFactory(), TRACING_INNER_CLIENT_NAME)); // ReadRow retries are handled in the overlay: disable retries in the base layer (but make // sure to preserve the exception callable settings). @@ -150,9 +151,7 @@ public static EnhancedBigtableStub create(EnhancedBigtableStubSettings settings) GrpcBigtableStub stub = new GrpcBigtableStub(baseSettings, clientContext); // Make sure to keep the original tracer factory for the outer client. - clientContext = clientContext.toBuilder() - .setTracerFactory(settings.getTracerFactory()) - .build(); + clientContext = clientContext.toBuilder().setTracerFactory(settings.getTracerFactory()).build(); return new EnhancedBigtableStub(settings, clientContext, stub); } @@ -263,9 +262,11 @@ private ServerStreamingCallable createReadRowsCallable( ReadRowsUserCallable userFacing = new ReadRowsUserCallable<>(filtering, requestContext); - TracedServerStreamingCallable traced = new TracedServerStreamingCallable<>( - userFacing, clientContext.getTracerFactory(), SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadRows") - ); + TracedServerStreamingCallable traced = + new TracedServerStreamingCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadRows")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } @@ -291,11 +292,11 @@ private UnaryCallable> createSampleRowKeysCallable() { UnaryCallable> userFacing = new SampleRowKeysCallable(retryable, requestContext); - UnaryCallable> traced = new TracedUnaryCallable<>( - userFacing, - clientContext.getTracerFactory(), - SpanName.of(TRACING_OUTER_CLIENT_NAME, "SampleRowKeys") - ); + UnaryCallable> traced = + new TracedUnaryCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "SampleRowKeys")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } @@ -310,11 +311,11 @@ private UnaryCallable> createSampleRowKeysCallable() { private UnaryCallable createMutateRowCallable() { MutateRowCallable userFacing = new MutateRowCallable(stub.mutateRowCallable(), requestContext); - UnaryCallable traced = new TracedUnaryCallable<>( - userFacing, - clientContext.getTracerFactory(), - SpanName.of(TRACING_OUTER_CLIENT_NAME, "MutateRow") - ); + UnaryCallable traced = + new TracedUnaryCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "MutateRow")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } @@ -335,11 +336,14 @@ private UnaryCallable createMutateRowCallable() { */ private UnaryCallable createBulkMutateRowsCallable() { UnaryCallable baseCallable = createMutateRowsBaseCallable(); - BulkMutateRowsUserFacingCallable userFacing = new BulkMutateRowsUserFacingCallable( - baseCallable, requestContext); + BulkMutateRowsUserFacingCallable userFacing = + new BulkMutateRowsUserFacingCallable(baseCallable, requestContext); - TracedUnaryCallable traced = new TracedUnaryCallable<>( - userFacing, clientContext.getTracerFactory(), SpanName.of(TRACING_OUTER_CLIENT_NAME, "BulkMutateRows")); + TracedUnaryCallable traced = + new TracedUnaryCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "BulkMutateRows")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } @@ -368,9 +372,12 @@ private UnaryCallable createBulkMutateRowsBatchingCallable() BatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor()) .setBatchingSettings(settings.bulkMutateRowsSettings().getBatchingSettings()); - TracedBatchingCallable traced = new TracedBatchingCallable<>( - baseCallable, clientContext.getTracerFactory(), SpanName.of(TRACING_OUTER_CLIENT_NAME, "BulkMutateRows"), - batchingCallSettings.getBatchingDescriptor()); + TracedBatchingCallable traced = + new TracedBatchingCallable<>( + baseCallable, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "BulkMutateRows"), + batchingCallSettings.getBatchingDescriptor()); UnaryCallable batching = Callables.batching(traced, batchingCallSettings.build(), clientContext); @@ -415,8 +422,11 @@ private UnaryCallable createCheckAndMutateRowCa CheckAndMutateRowCallable userFacing = new CheckAndMutateRowCallable(stub.checkAndMutateRowCallable(), requestContext); - TracedUnaryCallable traced = new TracedUnaryCallable<>( - userFacing, clientContext.getTracerFactory(), SpanName.of(TRACING_OUTER_CLIENT_NAME, "CheckAndMutateRow")); + TracedUnaryCallable traced = + new TracedUnaryCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "CheckAndMutateRow")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } @@ -434,9 +444,11 @@ private UnaryCallable createReadModifyWriteRowCallable( ReadModifyWriteRowCallable userFacing = new ReadModifyWriteRowCallable(stub.readModifyWriteRowCallable(), requestContext); - TracedUnaryCallable traced = new TracedUnaryCallable<>( - userFacing, clientContext.getTracerFactory(), - SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadModifyWriteRow")); + TracedUnaryCallable traced = + new TracedUnaryCallable<>( + userFacing, + clientContext.getTracerFactory(), + SpanName.of(TRACING_OUTER_CLIENT_NAME, "ReadModifyWriteRow")); return traced.withDefaultCallContext(clientContext.getDefaultCallContext()); } diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index 17499828f070..30eb2a938c58 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -41,10 +41,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.graph.ImmutableNetwork; import java.util.List; -import java.util.Map; import java.util.Set; import javax.annotation.Nonnull; import org.threeten.bp.Duration; @@ -276,13 +273,12 @@ private Builder() { setStreamWatchdogCheckInterval(baseDefaults.getStreamWatchdogCheckInterval()); setStreamWatchdogProvider(baseDefaults.getStreamWatchdogProvider()); - setTracerFactory(new OpencensusTracerFactory( - ImmutableMap.of( - "gax", GaxGrpcProperties.getGaxGrpcVersion(), - "grpc", GaxGrpcProperties.getGrpcVersion(), - "gapic", GaxProperties.getLibraryVersion(EnhancedBigtableStubSettings.class) - ) - )); + setTracerFactory( + new OpencensusTracerFactory( + ImmutableMap.of( + "gax", GaxGrpcProperties.getGaxGrpcVersion(), + "grpc", GaxGrpcProperties.getGrpcVersion(), + "gapic", GaxProperties.getLibraryVersion(EnhancedBigtableStubSettings.class)))); // Per-method settings using baseSettings for defaults. readRowsSettings = ServerStreamingCallSettings.newBuilder(); diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java index bf113be9a9ac..253d7a207ad9 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/tracing/WrappedTracerFactory.java @@ -18,9 +18,7 @@ import com.google.api.core.InternalApi; import com.google.api.gax.tracing.ApiTracer; import com.google.api.gax.tracing.ApiTracerFactory; -import com.google.api.gax.tracing.OpencensusTracerFactory; import com.google.api.gax.tracing.SpanName; -import org.threeten.bp.Duration; /** * Simple wrapper around {@link ApiTracerFactory} to augment the client name of the generated