Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 60be349

Browse files
committed
fix(bigtable): fix channel tracer start
1 parent 4a99a8c commit 60be349

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/ChannelPoolMetricsTracer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public void registerLoadBalancingStrategy(String lbPolicy) {
8888

8989
/** Starts the periodic collection. */
9090
public ScheduledFuture<?> start(ScheduledExecutorService scheduler) {
91-
return scheduler.scheduleAtFixedRate(
92-
this, SAMPLING_PERIOD_SECONDS, SAMPLING_PERIOD_SECONDS, TimeUnit.SECONDS);
91+
return scheduler.scheduleAtFixedRate(this, 0, SAMPLING_PERIOD_SECONDS, TimeUnit.SECONDS);
9392
}
9493

9594
@Override

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/grpc/BigtableTransportChannelProvider.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import java.util.Map;
3131
import java.util.concurrent.Executor;
3232
import java.util.concurrent.ScheduledExecutorService;
33+
import java.util.logging.Level;
34+
import java.util.logging.Logger;
3335
import javax.annotation.Nullable;
3436

3537
/**
@@ -38,7 +40,7 @@
3840
*/
3941
@InternalApi
4042
public final class BigtableTransportChannelProvider implements TransportChannelProvider {
41-
43+
static final Logger LOG = Logger.getLogger(BigtableTransportChannelProvider.class.getName());
4244
private final InstantiatingGrpcChannelProvider delegate;
4345
private final ChannelPrimer channelPrimer;
4446
@Nullable private final ChannelPoolMetricsTracer channelPoolMetricsTracer;
@@ -168,6 +170,13 @@ public TransportChannel getTransportChannel() throws IOException {
168170
channelPoolMetricsTracer.registerChannelInsightsProvider(btChannelPool::getChannelInfos);
169171
channelPoolMetricsTracer.registerLoadBalancingStrategy(
170172
btPoolSettings.getLoadBalancingStrategy().name());
173+
if (backgroundExecutor != null) {
174+
channelPoolMetricsTracer.start(backgroundExecutor);
175+
} else {
176+
LOG.log(
177+
Level.WARNING,
178+
"backgroundExecutor is null, ChannelPoolMetricsTracer cannot be started.");
179+
}
171180
}
172181

173182
return GrpcTransportChannel.create(btChannelPool);

0 commit comments

Comments
 (0)