From 1c9c6dfcf0cecd63590aa3958ad999fea770b79c Mon Sep 17 00:00:00 2001 From: Nidhi Nandwani Date: Thu, 19 Nov 2026 15:50:07 +0000 Subject: [PATCH 1/3] feat(storage): record gcp.storage.client.server.duration metric on gRPC [Generated-by: AI] --- .../cloud/storage/StorageClientMetrics.java | 13 ++ .../StorageGrpcMetricsInterceptor.java | 22 +++ .../storage/StorageClientMetricsTest.java | 63 +++++++++ .../StorageGrpcMetricsInterceptorTest.java | 133 ++++++++++++++++-- 4 files changed, 220 insertions(+), 11 deletions(-) diff --git a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java index 28f20fbb40da..19d2e04fed3d 100644 --- a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java +++ b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java @@ -539,6 +539,19 @@ void recordRequestActive(Context otelContext, String operationName, long delta) requestActive.add(delta, attributes, otelContext); } + void recordServerDuration( + Context otelContext, double durationSeconds, String operationName, String networkPath) { + if (serverDuration == null) { + return; + } + Attributes attributes = + baseAttributes.toBuilder() + .put(KEY_GCP_STORAGE_OPERATION, operationName) + .put(KEY_NETWORK_PATH, networkPath) + .build(); + serverDuration.record(durationSeconds, attributes, otelContext); + } + @Nullable static StorageMetricsContext createContext( @Nullable StorageClientMetrics metrics, String operationName) { diff --git a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java index d351094dbdb7..3152a215837c 100644 --- a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java +++ b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java @@ -36,6 +36,8 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.jspecify.annotations.NullMarked; @@ -48,6 +50,9 @@ @NullMarked final class StorageGrpcMetricsInterceptor implements ClientInterceptor { + static final Metadata.Key GRPC_SERVER_STATS_BIN_KEY = + Metadata.Key.of("grpc-server-stats-bin", Metadata.BINARY_BYTE_MARSHALLER); + private final StorageClientMetrics metrics; private final ApiClock clock; @@ -112,6 +117,13 @@ public void onClose(Status status, Metadata trailers) { metrics.recordRpcCallDuration( otelContext, durationSeconds, rpcMethod, statusCode, networkPath, errorType); + if (metrics.getServerDuration() != null) { + double serverDurationSeconds = decodeServerDurationSeconds(trailers); + if (serverDurationSeconds >= 0.0) { + metrics.recordServerDuration( + otelContext, serverDurationSeconds, operationName, networkPath); + } + } } finally { metrics.recordRequestActive(otelContext, operationName, -1L); super.onClose(status, trailers); @@ -131,6 +143,16 @@ public void sendMessage(ReqT message) { }; } + static double decodeServerDurationSeconds(Metadata trailers) { + byte[] bytes = trailers.get(GRPC_SERVER_STATS_BIN_KEY); + // Census ServerStats binary encoding: version (0x00), field ID (0x00), 8-byte LE uint64 nanos. + if (bytes == null || bytes.length != 10 || bytes[0] != 0 || bytes[1] != 0) { + return -1.0; + } + long nanos = ByteBuffer.wrap(bytes, 2, 8).order(ByteOrder.LITTLE_ENDIAN).getLong(); + return nanos >= 0 ? nanos / 1_000_000_000.0 : -1.0; + } + static String defaultOperationName(@Nullable String bareMethod) { if (bareMethod == null || bareMethod.isEmpty()) { return "UNKNOWN"; diff --git a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java index f9a74f80f884..2e3ad9a252ca 100644 --- a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java +++ b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java @@ -41,6 +41,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; +import org.jspecify.annotations.Nullable; import org.junit.Before; import org.junit.Test; @@ -525,6 +526,61 @@ public void recordRequestActive_recordsExactSixAttributes() { .isEqualTo(0L); } + @Test + public void recordServerDuration_recordsExactSevenAttributes() { + SdkMeterProvider provider = SdkMeterProvider.builder().registerMetricReader(reader).build(); + StorageClientMetrics standardMetrics = + StorageOptions.grpc() + .setProjectId("test-project") + .setCredentials(NoCredentials.getInstance()) + .setEnableOtelMetrics(true) + .setMeterProvider(provider) + .build() + .getStorageClientMetrics(); + standardMetrics.recordServerDuration( + Context.current(), 0.125, "ReadObject", StorageClientMetrics.NETWORK_PATH_DIRECTPATH); + assertThat(findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION)).isNull(); + + StorageClientMetrics grpcMetrics = + StorageOptions.grpc() + .setProjectId("test-project") + .setCredentials(NoCredentials.getInstance()) + .setEnableOtelMetrics(true) + .setEnableOtelDebugMetrics(true) + .setMeterProvider(provider) + .build() + .getStorageClientMetrics(); + + grpcMetrics.recordServerDuration( + Context.current(), 0.125, "ReadObject", StorageClientMetrics.NETWORK_PATH_DIRECTPATH); + + MetricData metricData = + findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION); + assertThat(metricData).isNotNull(); + assertThat(metricData.getUnit()).isEqualTo("s"); + assertThat(metricData.getHistogramData().getPoints()).hasSize(1); + HistogramPointData point = metricData.getHistogramData().getPoints().iterator().next(); + assertThat(point.getCount()).isEqualTo(1L); + assertThat(point.getSum()).isWithin(1e-6).of(0.125); + assertThat(point.getAttributes()) + .isEqualTo( + Attributes.builder() + .put( + StorageClientMetrics.KEY_GCP_CLIENT_SERVICE, + StorageClientMetrics.SERVICE_STORAGE) + .put(StorageClientMetrics.KEY_GCP_CLIENT_VERSION, StorageOptions.version()) + .put( + StorageClientMetrics.KEY_GCP_CLIENT_ARTIFACT, + StorageClientMetrics.ARTIFACT_STORAGE) + .put(StorageClientMetrics.KEY_RPC_SYSTEM_NAME, "grpc") + .put(StorageClientMetrics.KEY_SERVER_ADDRESS, "storage.googleapis.com") + .put(StorageClientMetrics.KEY_GCP_STORAGE_OPERATION, "ReadObject") + .put( + StorageClientMetrics.KEY_NETWORK_PATH, + StorageClientMetrics.NETWORK_PATH_DIRECTPATH) + .build()); + } + static final class TestMetricReader implements MetricReader { private final MetricReader delegate = InMemoryMetricReader.create(); final AtomicBoolean shutdownCalled = new AtomicBoolean(false); @@ -556,6 +612,13 @@ public CompletableResultCode shutdown() { } } + private @Nullable MetricData findMetric(String name) { + return reader.collectAllMetrics().stream() + .filter(m -> m.getName().equals(name)) + .findFirst() + .orElse(null); + } + private static int findBucketIndex(List boundaries, double value) { for (int i = 0; i < boundaries.size(); i++) { if (value <= boundaries.get(i)) { diff --git a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java index 67e078df724e..0675f0a89df7 100644 --- a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java +++ b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java @@ -17,6 +17,7 @@ package com.google.cloud.storage; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; import com.google.api.core.ApiClock; import com.google.api.gax.grpc.GrpcInterceptorProvider; @@ -56,6 +57,8 @@ import java.lang.reflect.Field; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -345,17 +348,7 @@ public void interceptCall_callFails_recordsErrorType() { @Test public void interceptCall_requestActive_tracksInFlightAndBalancesOnClose() { - StorageClientMetrics debugMetrics = - StorageOptions.grpc() - .setProjectId("test-project") - .setCredentials(NoCredentials.getInstance()) - .setEnableOtelMetrics(true) - .setEnableOtelDebugMetrics(true) - .setMeterProvider(meterProvider) - .build() - .getStorageClientMetrics(); - StorageGrpcMetricsInterceptor debugInterceptor = - new StorageGrpcMetricsInterceptor(debugMetrics, clock); + StorageGrpcMetricsInterceptor debugInterceptor = createDebugInterceptor(); TestClientCall okCall = new TestClientCall<>(Attributes.EMPTY); ClientCall wrappedOk = @@ -393,6 +386,102 @@ public void interceptCall_requestActive_tracksInFlightAndBalancesOnClose() { assertThat(requestActivePoint().getValue()).isEqualTo(0L); } + @Test + public void decodeServerDurationSeconds_cases() { + Object[][] cases = { + {"valid 125ms", encodeServerStats(0, 0, 125_000_000L), 0.125}, + { + "raw LE wire bytes 250ms", + new byte[] {0, 0, (byte) 0x80, (byte) 0xB2, (byte) 0xE6, 0x0E, 0, 0, 0, 0}, + 0.25 + }, + {"valid 0ns", encodeServerStats(0, 0, 0L), 0.0}, + {"absent trailer", null, -1.0}, + {"too short (9 bytes)", new byte[9], -1.0}, + {"too long (11 bytes)", new byte[11], -1.0}, + {"wrong version", encodeServerStats(1, 0, 125_000_000L), -1.0}, + {"wrong field id", encodeServerStats(0, 1, 125_000_000L), -1.0}, + {"negative nanos overflow", encodeServerStats(0, 0, Long.MIN_VALUE), -1.0}, + }; + for (Object[] testCase : cases) { + String label = (String) testCase[0]; + byte[] payload = (byte[]) testCase[1]; + double expected = (double) testCase[2]; + Metadata trailers = new Metadata(); + if (payload != null) { + trailers.put(StorageGrpcMetricsInterceptor.GRPC_SERVER_STATS_BIN_KEY, payload); + } + assertWithMessage(label) + .that(StorageGrpcMetricsInterceptor.decodeServerDurationSeconds(trailers)) + .isWithin(1e-9) + .of(expected); + } + } + + @Test + public void interceptCall_serverDuration_recordsWhenDebugEnabledAndValidTrailerPresent() + throws Exception { + Attributes directPathAttrs = + Attributes.newBuilder() + .set( + Grpc.TRANSPORT_ATTR_REMOTE_ADDR, + new InetSocketAddress(InetAddress.getByName("34.126.1.2"), 443)) + .build(); + Metadata validTrailers = new Metadata(); + validTrailers.put( + StorageGrpcMetricsInterceptor.GRPC_SERVER_STATS_BIN_KEY, + encodeServerStats(0, 0, 250_000_000L)); + + // Debug disabled: must not record server.duration even when trailer is present. + TestClientCall standardCall = new TestClientCall<>(directPathAttrs); + interceptor + .interceptCall(READ_OBJECT_METHOD, CallOptions.DEFAULT, new TestChannel(standardCall)) + .start(new TestListener<>(), new Metadata()); + standardCall.close(Status.OK, validTrailers); + assertThat(findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION)).isNull(); + + // Debug enabled: records exact 7-key server.duration on valid 10-byte trailer; skips absent. + StorageGrpcMetricsInterceptor debugInterceptor = createDebugInterceptor(); + + TestClientCall noTrailerCall = new TestClientCall<>(directPathAttrs); + debugInterceptor + .interceptCall(READ_OBJECT_METHOD, CallOptions.DEFAULT, new TestChannel(noTrailerCall)) + .start(new TestListener<>(), new Metadata()); + noTrailerCall.close(Status.OK, new Metadata()); + assertThat(findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION)).isNull(); + + TestClientCall withTrailerCall = new TestClientCall<>(directPathAttrs); + debugInterceptor + .interceptCall(READ_OBJECT_METHOD, CallOptions.DEFAULT, new TestChannel(withTrailerCall)) + .start(new TestListener<>(), new Metadata()); + withTrailerCall.close(Status.OK, validTrailers); + + MetricData serverDuration = + findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION); + assertThat(serverDuration).isNotNull(); + assertThat(serverDuration.getHistogramData().getPoints()).hasSize(1); + HistogramPointData point = serverDuration.getHistogramData().getPoints().iterator().next(); + assertThat(point.getCount()).isEqualTo(1L); + assertThat(point.getSum()).isWithin(1e-6).of(0.25); + assertThat(point.getAttributes()) + .isEqualTo( + io.opentelemetry.api.common.Attributes.builder() + .put( + StorageClientMetrics.KEY_GCP_CLIENT_SERVICE, + StorageClientMetrics.SERVICE_STORAGE) + .put(StorageClientMetrics.KEY_GCP_CLIENT_VERSION, StorageOptions.version()) + .put( + StorageClientMetrics.KEY_GCP_CLIENT_ARTIFACT, + StorageClientMetrics.ARTIFACT_STORAGE) + .put(StorageClientMetrics.KEY_RPC_SYSTEM_NAME, "grpc") + .put(StorageClientMetrics.KEY_SERVER_ADDRESS, "storage.googleapis.com") + .put(StorageClientMetrics.KEY_GCP_STORAGE_OPERATION, "ReadObject") + .put( + StorageClientMetrics.KEY_NETWORK_PATH, + StorageClientMetrics.NETWORK_PATH_DIRECTPATH) + .build()); + } + @Test public void interceptCall_withStorageMetricsContext_propagatesContextAndFeedsNetworkPath() throws Exception { @@ -646,6 +735,28 @@ public void grpcStorageOptions_interceptorProviderWiring() throws Exception { assertThat(extractInterceptorProvider(disabledDefaultChannelProvider)).isNull(); } + private StorageGrpcMetricsInterceptor createDebugInterceptor() { + StorageClientMetrics debugMetrics = + StorageOptions.grpc() + .setProjectId("test-project") + .setCredentials(NoCredentials.getInstance()) + .setEnableOtelMetrics(true) + .setEnableOtelDebugMetrics(true) + .setMeterProvider(meterProvider) + .build() + .getStorageClientMetrics(); + return new StorageGrpcMetricsInterceptor(debugMetrics, clock); + } + + private static byte[] encodeServerStats(int version, int fieldId, long nanos) { + return ByteBuffer.allocate(10) + .order(ByteOrder.LITTLE_ENDIAN) + .put((byte) version) + .put((byte) fieldId) + .putLong(nanos) + .array(); + } + private LongPointData requestActivePoint() { MetricData metric = findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_REQUEST_ACTIVE); assertThat(metric).isNotNull(); From 4bf59ce26bb76f6a3873d553a60d038d9f0fee8b Mon Sep 17 00:00:00 2001 From: Nidhi Nandwani Date: Thu, 26 Nov 2026 05:22:10 +0000 Subject: [PATCH 2/3] fix(storage): accept grpc-server-stats-bin payloads with trailing fields - decodeServerDurationSeconds accepts payloads of at least 10 bytes, still requiring the version/field-id header and reading the LE nanos at offset 2. - Cover a 0ns trailer and a non-OK status in the server.duration test, assert its unit, and reuse createDebugInterceptor() in the request.active tests. [Generated-by: AI] --- .../StorageGrpcMetricsInterceptor.java | 3 +- .../StorageGrpcMetricsInterceptorTest.java | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java index 21c599b3ceb4..25d9b5366660 100644 --- a/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java +++ b/java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageGrpcMetricsInterceptor.java @@ -166,7 +166,8 @@ public void sendMessage(ReqT message) { static double decodeServerDurationSeconds(Metadata trailers) { byte[] bytes = trailers.get(GRPC_SERVER_STATS_BIN_KEY); // Census ServerStats binary encoding: version (0x00), field ID (0x00), 8-byte LE uint64 nanos. - if (bytes == null || bytes.length != 10 || bytes[0] != 0 || bytes[1] != 0) { + // Any additional trailing fields are ignored. + if (bytes == null || bytes.length < 10 || bytes[0] != 0 || bytes[1] != 0) { return -1.0; } long nanos = ByteBuffer.wrap(bytes, 2, 8).order(ByteOrder.LITTLE_ENDIAN).getLong(); diff --git a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java index 7fb825fb9d19..eeabd9df3a17 100644 --- a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java +++ b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageGrpcMetricsInterceptorTest.java @@ -25,6 +25,7 @@ import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.cloud.NoCredentials; import com.google.common.collect.ImmutableList; +import com.google.common.primitives.Bytes; import com.google.storage.v2.BidiWriteObjectRequest; import com.google.storage.v2.BidiWriteObjectResponse; import com.google.storage.v2.ReadObjectRequest; @@ -399,7 +400,11 @@ public void decodeServerDurationSeconds_cases() { {"valid 0ns", encodeServerStats(0, 0, 0L), 0.0}, {"absent trailer", null, -1.0}, {"too short (9 bytes)", new byte[9], -1.0}, - {"too long (11 bytes)", new byte[11], -1.0}, + { + "trailing fields ignored (13 bytes)", + Bytes.concat(encodeServerStats(0, 0, 125_000_000L), new byte[] {1, 0, 7}), + 0.125 + }, {"wrong version", encodeServerStats(1, 0, 125_000_000L), -1.0}, {"wrong field id", encodeServerStats(0, 1, 125_000_000L), -1.0}, {"negative nanos overflow", encodeServerStats(0, 0, Long.MIN_VALUE), -1.0}, @@ -457,13 +462,29 @@ public void interceptCall_serverDuration_recordsWhenDebugEnabledAndValidTrailerP .start(new TestListener<>(), new Metadata()); withTrailerCall.close(Status.OK, validTrailers); + // Recorded regardless of the call status, and for a 0ns server duration. + TestClientCall failedCall = new TestClientCall<>(directPathAttrs); + debugInterceptor + .interceptCall(READ_OBJECT_METHOD, CallOptions.DEFAULT, new TestChannel(failedCall)) + .start(new TestListener<>(), new Metadata()); + failedCall.close(Status.UNAVAILABLE, validTrailers); + Metadata zeroTrailers = new Metadata(); + zeroTrailers.put( + StorageGrpcMetricsInterceptor.GRPC_SERVER_STATS_BIN_KEY, encodeServerStats(0, 0, 0L)); + TestClientCall zeroCall = new TestClientCall<>(directPathAttrs); + debugInterceptor + .interceptCall(READ_OBJECT_METHOD, CallOptions.DEFAULT, new TestChannel(zeroCall)) + .start(new TestListener<>(), new Metadata()); + zeroCall.close(Status.OK, zeroTrailers); + MetricData serverDuration = findMetric(StorageClientMetrics.METRIC_GCP_STORAGE_CLIENT_SERVER_DURATION); assertThat(serverDuration).isNotNull(); + assertThat(serverDuration.getUnit()).isEqualTo("s"); assertThat(serverDuration.getHistogramData().getPoints()).hasSize(1); HistogramPointData point = serverDuration.getHistogramData().getPoints().iterator().next(); - assertThat(point.getCount()).isEqualTo(1L); - assertThat(point.getSum()).isWithin(1e-6).of(0.25); + assertThat(point.getCount()).isEqualTo(3L); + assertThat(point.getSum()).isWithin(1e-6).of(0.5); assertThat(point.getAttributes()) .isEqualTo( io.opentelemetry.api.common.Attributes.builder() @@ -485,17 +506,7 @@ public void interceptCall_serverDuration_recordsWhenDebugEnabledAndValidTrailerP @Test public void interceptCall_requestActive_balancesWhenStartThrows() { - StorageClientMetrics debugMetrics = - StorageOptions.grpc() - .setProjectId("test-project") - .setCredentials(NoCredentials.getInstance()) - .setEnableOtelMetrics(true) - .setEnableOtelDebugMetrics(true) - .setMeterProvider(meterProvider) - .build() - .getStorageClientMetrics(); - StorageGrpcMetricsInterceptor debugInterceptor = - new StorageGrpcMetricsInterceptor(debugMetrics, clock); + StorageGrpcMetricsInterceptor debugInterceptor = createDebugInterceptor(); IllegalStateException failure = new IllegalStateException("start failed"); Channel throwingChannel = Mockito.mock(Channel.class); @SuppressWarnings("unchecked") @@ -516,17 +527,7 @@ public void interceptCall_requestActive_balancesWhenStartThrows() { @Test public void interceptCall_requestActive_releasesOnceWhenClosedInlineBeforeStartThrows() { - StorageClientMetrics debugMetrics = - StorageOptions.grpc() - .setProjectId("test-project") - .setCredentials(NoCredentials.getInstance()) - .setEnableOtelMetrics(true) - .setEnableOtelDebugMetrics(true) - .setMeterProvider(meterProvider) - .build() - .getStorageClientMetrics(); - StorageGrpcMetricsInterceptor debugInterceptor = - new StorageGrpcMetricsInterceptor(debugMetrics, clock); + StorageGrpcMetricsInterceptor debugInterceptor = createDebugInterceptor(); IllegalStateException failure = new IllegalStateException("start failed after close"); Channel throwingChannel = Mockito.mock(Channel.class); @SuppressWarnings("unchecked") From 325a275b4a056cf0288c2bddbfe5a4d78d207745 Mon Sep 17 00:00:00 2001 From: Nidhi Nandwani Date: Thu, 26 Nov 2026 05:31:50 +0000 Subject: [PATCH 3/3] test(storage): remove findMetric helper left unused after dropping the duplicated test [Generated-by: AI] --- .../google/cloud/storage/StorageClientMetricsTest.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java index 2a859a8792da..a835ad6fbb1a 100644 --- a/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java +++ b/java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageClientMetricsTest.java @@ -38,7 +38,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; -import org.jspecify.annotations.Nullable; import org.junit.Before; import org.junit.Test; @@ -452,13 +451,6 @@ public CompletableResultCode shutdown() { } } - private @Nullable MetricData findMetric(String name) { - return reader.collectAllMetrics().stream() - .filter(m -> m.getName().equals(name)) - .findFirst() - .orElse(null); - } - private static int findBucketIndex(List boundaries, double value) { for (int i = 0; i < boundaries.size(); i++) { if (value <= boundaries.get(i)) {