From 3429c2eaf667aeaa1803c03da6877c69a412a68b Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Tue, 29 Oct 2024 17:34:06 -0400 Subject: [PATCH] chore: add feature flags for DirectAccess Change-Id: I81d16773980bff6232ffe20839a9968718a361b1 --- .../data/v2/stub/EnhancedBigtableStubSettings.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index 2a3d0ddba4..5e5dc64fd9 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -105,7 +105,9 @@ public class EnhancedBigtableStubSettings extends StubSettings IDEMPOTENT_RETRY_CODES = ImmutableSet.of(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE); @@ -376,10 +378,9 @@ public String getMetricsEndpoint() { /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - Boolean isDirectpathEnabled = Boolean.parseBoolean(System.getenv(CBT_ENABLE_DIRECTPATH)); InstantiatingGrpcChannelProvider.Builder grpcTransportProviderBuilder = BigtableStubSettings.defaultGrpcTransportProviderBuilder(); - if (isDirectpathEnabled) { + if (DIRECT_PATH_ENABLED) { // Attempts direct access to CBT service over gRPC to improve throughput, // whether the attempt is allowed is totally controlled by service owner. grpcTransportProviderBuilder @@ -830,7 +831,11 @@ private Builder() { .setWaitTimeout(Duration.ofMinutes(5)); featureFlags = - FeatureFlags.newBuilder().setReverseScans(true).setLastScannedRowResponses(true); + FeatureFlags.newBuilder() + .setReverseScans(true) + .setLastScannedRowResponses(true) + .setDirectAccessRequested(DIRECT_PATH_ENABLED) + .setTrafficDirectorEnabled(DIRECT_PATH_ENABLED); } private Builder(EnhancedBigtableStubSettings settings) {