fix: ensure that multiple instances of a client in the same process d… · googleapis/java-bigtable@8d3dca4 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 8d3dca4

Browse files
fix: ensure that multiple instances of a client in the same process dont clobber each other (#2590)
* fix: ensure that multiple instances of a client in the same process dont clobber each other Change-Id: I2087777f1f2d37c62f33c63a7ecb67f7a93712b8 * chore: generate libraries at Wed May 28 14:16:03 UTC 2025 --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent 051e8cb commit 8d3dca4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import java.util.Map;
6767
import java.util.Optional;
6868
import java.util.concurrent.atomic.AtomicBoolean;
69+
import java.util.concurrent.atomic.AtomicLong;
6970
import java.util.logging.Level;
7071
import java.util.logging.Logger;
7172
import java.util.stream.Collectors;
@@ -302,10 +303,14 @@ static class PublicTimeSeriesConverter implements TimeSeriesConverter {
302303
.map(m -> METER_NAME + m)
303304
.collect(ImmutableList.toImmutableList());
304305

306+
private static final AtomicLong nextTaskIdSuffix = new AtomicLong();
305307
private final String taskId;
306308

307309
PublicTimeSeriesConverter() {
308-
this(BigtableExporterUtils.DEFAULT_TASK_VALUE.get());
310+
this(
311+
BigtableExporterUtils.DEFAULT_TASK_VALUE.get()
312+
+ "-"
313+
+ nextTaskIdSuffix.getAndIncrement());
309314
}
310315

311316
PublicTimeSeriesConverter(String taskId) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import java.util.Optional;
8080
import java.util.Set;
8181
import java.util.UUID;
82+
import java.util.concurrent.atomic.AtomicLong;
8283
import java.util.logging.Level;
8384
import java.util.logging.Logger;
8485
import java.util.stream.Collectors;
@@ -102,6 +103,8 @@ class BigtableExporterUtils {
102103
GCPPlatformDetector.SupportedPlatform.GOOGLE_COMPUTE_ENGINE, "gcp_compute_engine",
103104
GCPPlatformDetector.SupportedPlatform.GOOGLE_KUBERNETES_ENGINE, "gcp_kubernetes_engine");
104105

106+
private static final AtomicLong nextUuidSuffix = new AtomicLong();
107+
105108
private BigtableExporterUtils() {}
106109

107110
/**
@@ -249,7 +252,7 @@ private static MonitoredResource detectResource(EnhancedBigtableStubSettings set
249252
.putLabels("host_id", attrs.get(AttributeKeys.GKE_HOST_ID))
250253
.putLabels("host_name", hostname)
251254
.putLabels("client_name", CLIENT_NAME)
252-
.putLabels("uuid", DEFAULT_TASK_VALUE.get())
255+
.putLabels("uuid", DEFAULT_TASK_VALUE.get() + "-" + nextUuidSuffix.getAndIncrement())
253256
.build();
254257
}
255258

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.