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

Commit ae038a5

Browse files
chore: generate libraries at Tue Feb 24 20:05:15 UTC 2026
1 parent 5b05b98 commit ae038a5

10 files changed

Lines changed: 126 additions & 64 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClientFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ public BigtableDataClient createDefault() {
131131
*/
132132
public BigtableDataClient createForAppProfile(@Nonnull String appProfileId) throws IOException {
133133
BigtableClientContext ctx =
134-
sharedClientContext.createChild(sharedClientContext.getClientInfo().getInstanceName(), appProfileId);
134+
sharedClientContext.createChild(
135+
sharedClientContext.getClientInfo().getInstanceName(), appProfileId);
135136

136137
return new BigtableDataClient(new EnhancedBigtableStub(perOpSettings, ctx));
137138
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/metrics/ClientChannelPoolOutstandingRpcs.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public void record(
4646
rpcCount,
4747
getSchema()
4848
.createResourceAttrs(clientInfo)
49-
.put(
50-
MetricLabels.TRANSPORT_TYPE,
51-
Util.transportTypeToString(transportType))
49+
.put(MetricLabels.TRANSPORT_TYPE, Util.transportTypeToString(transportType))
5250
.put(MetricLabels.CHANNEL_POOL_LB_POLICY, lbPolicy.name())
5351
.put(MetricLabels.STREAMING_KEY, isStreaming)
5452
.build());

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/metrics/ClientDpCompatGuage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ private Recorder(Meter meter) {
2727
.gaugeBuilder(NAME)
2828
.ofLongs()
2929
.setDescription(
30-
"Reports 1 if the environment is eligible for DirectPath, 0 otherwise. Based on an attempt at startup.")
30+
"Reports 1 if the environment is eligible for DirectPath, 0 otherwise. Based on"
31+
+ " an attempt at startup.")
3132
.setUnit("1")
3233
.build();
3334
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/metrics/TableBatchWriteFlowControlFactor.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
import io.opentelemetry.api.metrics.Meter;
2929

3030
public class TableBatchWriteFlowControlFactor extends MetricWrapper<TableSchema> {
31-
private static final String NAME = "bigtable.googleapis.com/internal/client/batch_write_flow_control_target_qps";
31+
private static final String NAME =
32+
"bigtable.googleapis.com/internal/client/batch_write_flow_control_target_qps";
3233

3334
public TableBatchWriteFlowControlFactor() {
3435
super(TableSchema.INSTANCE, NAME);
3536
}
37+
3638
@Override
3739
public ImmutableMap<String, String> extractMetricLabels(
3840
Attributes metricAttrs, EnvInfo envInfo, ClientInfo clientInfo) {
@@ -50,11 +52,13 @@ public class Recorder {
5052
private final DoubleGauge instrument;
5153

5254
private Recorder(Meter meter) {
53-
this.instrument = meter
54-
.gaugeBuilder(NAME)
55-
.setDescription("The current target QPS of the client under batch write flow control.")
56-
.setUnit("1")
57-
.build();
55+
this.instrument =
56+
meter
57+
.gaugeBuilder(NAME)
58+
.setDescription(
59+
"The current target QPS of the client under batch write flow control.")
60+
.setUnit("1")
61+
.build();
5862
}
5963

6064
public void record(

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/csm/metrics/TableBatchWriteFlowControlTargetQps.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@
2222
import com.google.cloud.bigtable.data.v2.internal.csm.metrics.Constants.MetricLabels;
2323
import com.google.cloud.bigtable.data.v2.internal.csm.schema.TableSchema;
2424
import com.google.common.collect.ImmutableMap;
25-
import io.grpc.Status;
2625
import io.opentelemetry.api.common.Attributes;
2726
import io.opentelemetry.api.metrics.DoubleGauge;
2827
import io.opentelemetry.api.metrics.Meter;
2928

3029
public class TableBatchWriteFlowControlTargetQps extends MetricWrapper<TableSchema> {
31-
private static final String NAME = "bigtable.googleapis.com/internal/client/batch_write_flow_control_target_qps";
30+
private static final String NAME =
31+
"bigtable.googleapis.com/internal/client/batch_write_flow_control_target_qps";
3232

3333
public TableBatchWriteFlowControlTargetQps() {
3434
super(TableSchema.INSTANCE, NAME);
3535
}
36+
3637
@Override
3738
public ImmutableMap<String, String> extractMetricLabels(
3839
Attributes metricAttrs, EnvInfo envInfo, ClientInfo clientInfo) {
@@ -50,11 +51,13 @@ public class Recorder {
5051
private final DoubleGauge instrument;
5152

5253
private Recorder(Meter meter) {
53-
this.instrument = meter
54-
.gaugeBuilder(NAME)
55-
.setDescription("The current target QPS of the client under batch write flow control.")
56-
.setUnit("1")
57-
.build();
54+
this.instrument =
55+
meter
56+
.gaugeBuilder(NAME)
57+
.setDescription(
58+
"The current target QPS of the client under batch write flow control.")
59+
.setUnit("1")
60+
.build();
5861
}
5962

6063
public void record(

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ public static BigtableClientContext create(
8484
EnhancedBigtableStubSettings settings, Tagger ocTagger, StatsRecorder ocRecorder)
8585
throws IOException {
8686

87-
ClientInfo clientInfo = ClientInfo.builder()
88-
.setInstanceName(InstanceName.of(settings.getProjectId(), settings.getInstanceId()))
89-
.setAppProfileId(settings.getAppProfileId())
90-
.build();
87+
ClientInfo clientInfo =
88+
ClientInfo.builder()
89+
.setInstanceName(InstanceName.of(settings.getProjectId(), settings.getInstanceId()))
90+
.setAppProfileId(settings.getAppProfileId())
91+
.build();
9192

9293
EnhancedBigtableStubSettings.Builder builder = settings.toBuilder();
9394

@@ -286,10 +287,7 @@ public BigtableClientContext createChild(InstanceName instanceName, String appPr
286287
throws IOException {
287288
return new BigtableClientContext(
288289
true,
289-
clientInfo.toBuilder()
290-
.setInstanceName(instanceName)
291-
.setAppProfileId(appProfileId)
292-
.build(),
290+
clientInfo.toBuilder().setInstanceName(instanceName).setAppProfileId(appProfileId).build(),
293291
clientContext,
294292
userTracerFactory,
295293
builtinOpenTelemetry,

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

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class BuiltinMetricsTracer extends BigtableTracer {
7474

7575
private final AtomicLong totalClientBlockingTime = new AtomicLong(0);
7676

77-
7877
private final AtomicLong grpcMessageSentDelay = new AtomicLong(0);
7978

8079
private Deadline operationDeadline = null;
@@ -289,17 +288,35 @@ private void recordOperationCompletion(@Nullable Throwable status) {
289288
// Only record when retry count is greater than 0 so the retry
290289
// graph will be less confusing
291290
if (attemptCount > 1) {
292-
recorder.retryCount.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, attemptCount - 1);
291+
recorder.retryCount.record(
292+
clientInfo,
293+
tableId,
294+
methodInfo,
295+
sidebandData.getResponseParams(),
296+
code,
297+
attemptCount - 1);
293298
}
294299

295-
recorder.operationLatency.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, operationLatency);
300+
recorder.operationLatency.record(
301+
clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, operationLatency);
296302

297303
// serverLatencyTimer should already be stopped in recordAttemptCompletion
298304
long applicationLatencyNano = operationLatency.toNanos() - totalServerLatencyNano.get();
299-
recorder.applicationBlockingLatency.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), Duration.ofNanos(applicationLatencyNano));
305+
recorder.applicationBlockingLatency.record(
306+
clientInfo,
307+
tableId,
308+
methodInfo,
309+
sidebandData.getResponseParams(),
310+
Duration.ofNanos(applicationLatencyNano));
300311

301312
if (methodInfo.getStreaming() && "ReadRows".equals(methodInfo.getName())) {
302-
recorder.firstResponseLantency.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, firstResponsePerOpTimer.elapsed());
313+
recorder.firstResponseLantency.record(
314+
clientInfo,
315+
tableId,
316+
methodInfo,
317+
sidebandData.getResponseParams(),
318+
code,
319+
firstResponsePerOpTimer.elapsed());
303320
}
304321
}
305322

@@ -327,26 +344,55 @@ private void recordAttemptCompletion(@Nullable Throwable status) {
327344
Status.Code code = extractStatus(status);
328345

329346
totalClientBlockingTime.addAndGet(grpcMessageSentDelay.get());
330-
recorder.clientBlockingLatency.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), Duration.ofNanos(totalClientBlockingTime.get()));
331-
332-
recorder.attemptLatency.record(clientInfo, tableId, sidebandData.getResponseParams(), methodInfo, code, attemptTimer.elapsed());
333-
334-
recorder.attemptLatency2.record(clientInfo, tableId, sidebandData.getPeerInfo(), sidebandData.getResponseParams(), methodInfo, code, attemptTimer.elapsed());
335-
347+
recorder.clientBlockingLatency.record(
348+
clientInfo,
349+
tableId,
350+
methodInfo,
351+
sidebandData.getResponseParams(),
352+
Duration.ofNanos(totalClientBlockingTime.get()));
353+
354+
recorder.attemptLatency.record(
355+
clientInfo,
356+
tableId,
357+
sidebandData.getResponseParams(),
358+
methodInfo,
359+
code,
360+
attemptTimer.elapsed());
361+
362+
recorder.attemptLatency2.record(
363+
clientInfo,
364+
tableId,
365+
sidebandData.getPeerInfo(),
366+
sidebandData.getResponseParams(),
367+
methodInfo,
368+
code,
369+
attemptTimer.elapsed());
336370

337371
// When operationDeadline is set, it's possible that the deadline is passed by the time we send
338372
// a new attempt. In this case we'll record 0.
339373
if (operationDeadline != null) {
340-
recorder.remainingDeadline.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code,
374+
recorder.remainingDeadline.record(
375+
clientInfo,
376+
tableId,
377+
methodInfo,
378+
sidebandData.getResponseParams(),
379+
code,
341380
Duration.ofMillis(Math.max(0, remainingDeadlineAtAttemptStart)));
342381
}
343382

344383
if (sidebandData.getGfeTiming() != null) {
345-
recorder.serverLatency.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code,
384+
recorder.serverLatency.record(
385+
clientInfo,
386+
tableId,
387+
methodInfo,
388+
sidebandData.getResponseParams(),
389+
code,
346390
Duration.ofMillis(sidebandData.getGfeTiming()));
347-
recorder.connectivityErrorCount.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, 0);
391+
recorder.connectivityErrorCount.record(
392+
clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, 0);
348393
} else {
349-
recorder.connectivityErrorCount.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, 1);
394+
recorder.connectivityErrorCount.record(
395+
clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, 1);
350396
}
351397
}
352398

@@ -357,14 +403,16 @@ private static double convertToMs(long nanoSeconds) {
357403

358404
@Override
359405
public void setBatchWriteFlowControlTargetQps(double targetQps) {
360-
recorder.batchWriteFlowControlTargetQps.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), targetQps);
406+
recorder.batchWriteFlowControlTargetQps.record(
407+
clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), targetQps);
361408
}
362409

363410
@Override
364411
public void addBatchWriteFlowControlFactor(
365412
double factor, @Nullable Throwable status, boolean applied) {
366413
Status.Code code = Util.extractStatus(status);
367414

368-
recorder.batchWriteFlowControlFactor.record(clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, applied, factor);
415+
recorder.batchWriteFlowControlFactor.record(
416+
clientInfo, tableId, methodInfo, sidebandData.getResponseParams(), code, applied, factor);
369417
}
370418
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ public static BuiltinMetricsTracerFactory create(
4747

4848
@Override
4949
public ApiTracer newTracer(ApiTracer parent, SpanName spanName, OperationType operationType) {
50-
MethodInfo methodInfo = MethodInfo.builder()
51-
.setName(spanName.getMethodName())
52-
.setStreaming(operationType == OperationType.ServerStreaming)
53-
.build();
50+
MethodInfo methodInfo =
51+
MethodInfo.builder()
52+
.setName(spanName.getMethodName())
53+
.setStreaming(operationType == OperationType.ServerStreaming)
54+
.build();
5455
return new BuiltinMetricsTracer(recorder, clientInfo, methodInfo);
5556
}
5657
}

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ public class Util {
8080
static final Metadata.Key<String> ATTEMPT_EPOCH_KEY =
8181
Metadata.Key.of("bigtable-client-attempt-epoch-usec", Metadata.ASCII_STRING_MARSHALLER);
8282

83-
8483
public static Status.Code extractStatus(@Nullable Throwable error) {
8584
if (error == null) {
8685
return Status.Code.OK;
8786
}
8887
if (error instanceof ApiException) {
8988
ApiException apiException = (ApiException) error;
9089
if (apiException.getStatusCode() instanceof GrpcStatusCode) {
91-
return ((GrpcStatusCode)apiException.getStatusCode()).getTransportCode();
90+
return ((GrpcStatusCode) apiException.getStatusCode()).getTransportCode();
9291
}
9392
}
9493

@@ -236,9 +235,14 @@ public static ApiTracerFactory createOCTracingFactory(ClientInfo clientInfo) {
236235
return new OpencensusTracerFactory(
237236
ImmutableMap.<String, String>builder()
238237
// Annotate traces with the same tags as metrics
239-
.put(RpcMeasureConstants.BIGTABLE_PROJECT_ID.getName(), clientInfo.getInstanceName().getProject())
240-
.put(RpcMeasureConstants.BIGTABLE_INSTANCE_ID.getName(), clientInfo.getInstanceName().getInstance())
241-
.put(RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID.getName(), clientInfo.getAppProfileId())
238+
.put(
239+
RpcMeasureConstants.BIGTABLE_PROJECT_ID.getName(),
240+
clientInfo.getInstanceName().getProject())
241+
.put(
242+
RpcMeasureConstants.BIGTABLE_INSTANCE_ID.getName(),
243+
clientInfo.getInstanceName().getInstance())
244+
.put(
245+
RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID.getName(), clientInfo.getAppProfileId())
242246
// Also annotate traces with library versions
243247
.put("gax", GaxGrpcProperties.getGaxGrpcVersion())
244248
.put("grpc", GaxGrpcProperties.getGrpcVersion())
@@ -252,11 +256,14 @@ public static ApiTracerFactory createOCMetricsFactory(
252256
ImmutableMap<TagKey, TagValue> attributes =
253257
ImmutableMap.<TagKey, TagValue>builder()
254258
.put(
255-
RpcMeasureConstants.BIGTABLE_PROJECT_ID, TagValue.create(clientInfo.getInstanceName().getProject()))
259+
RpcMeasureConstants.BIGTABLE_PROJECT_ID,
260+
TagValue.create(clientInfo.getInstanceName().getProject()))
256261
.put(
257262
RpcMeasureConstants.BIGTABLE_INSTANCE_ID,
258263
TagValue.create(clientInfo.getInstanceName().getInstance()))
259-
.put(RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID, TagValue.create(clientInfo.getAppProfileId()))
264+
.put(
265+
RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID,
266+
TagValue.create(clientInfo.getAppProfileId()))
260267
.build();
261268
return MetricsTracerFactory.create(tagger, stats, attributes);
262269
}

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracerTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ public class BuiltinMetricsTracerTest {
170170
private ClientInfo clientInfo;
171171
private Attributes expectedBaseAttributes;
172172

173-
174173
private InMemoryMetricReader metricReader;
175174

176175
private DelayProxyDetector delayProxyDetector;
@@ -181,15 +180,17 @@ public class BuiltinMetricsTracerTest {
181180
public void setUp() throws Exception {
182181
metricReader = InMemoryMetricReader.create();
183182

184-
clientInfo = ClientInfo.builder()
185-
.setInstanceName(InstanceName.of(PROJECT_ID, INSTANCE_ID))
186-
.setAppProfileId(APP_PROFILE_ID)
187-
.build();
188-
expectedBaseAttributes = Attributes.builder()
189-
.put(BuiltinMetricsConstants.BIGTABLE_PROJECT_ID_KEY, PROJECT_ID)
190-
.put(BuiltinMetricsConstants.INSTANCE_ID_KEY, INSTANCE_ID)
191-
.put(BuiltinMetricsConstants.APP_PROFILE_KEY, APP_PROFILE_ID)
192-
.build();
183+
clientInfo =
184+
ClientInfo.builder()
185+
.setInstanceName(InstanceName.of(PROJECT_ID, INSTANCE_ID))
186+
.setAppProfileId(APP_PROFILE_ID)
187+
.build();
188+
expectedBaseAttributes =
189+
Attributes.builder()
190+
.put(BuiltinMetricsConstants.BIGTABLE_PROJECT_ID_KEY, PROJECT_ID)
191+
.put(BuiltinMetricsConstants.INSTANCE_ID_KEY, INSTANCE_ID)
192+
.put(BuiltinMetricsConstants.APP_PROFILE_KEY, APP_PROFILE_ID)
193+
.build();
193194

194195
SdkMeterProviderBuilder meterProvider =
195196
SdkMeterProvider.builder().registerMetricReader(metricReader);

0 commit comments

Comments
 (0)