Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
07f72be
feat(storage): add OpenTelemetry client metrics infrastructure and co…
nidhiii-27 Sep 16, 2026
235a230
fix(storage): resolve code formatting violations for client metrics
nidhiii-27 Sep 16, 2026
590ad9e
fix(storage): resolve PR review comments on OpenTelemetry metrics
nidhiii-27 Sep 16, 2026
02a7740
fix(storage): resolve code formatting violation in OpenTelemetryBoots…
nidhiii-27 Sep 16, 2026
f686723
feat(storage): add OpenTelemetry client metrics instrument registry a…
nidhiii-27 Sep 23, 2026
babb702
fix(storage): refactor histogram views and remove deferred connection…
nidhiii-27 Sep 30, 2026
22a233f
fix(storage): support transport-derived api label in createClientMete…
nidhiii-27 Oct 7, 2026
1f2c146
fix(storage): address review comments for OpenTelemetry client metrics
nidhiii-27 Oct 8, 2026
7828fd2
feat(storage): address review feedback on client metrics infra
nidhiii-27 Oct 14, 2026
983f248
style(storage): format code with fmt-maven-plugin
nidhiii-27 Oct 14, 2026
52cd16a
refactor(storage): address PR review comments for OpenTelemetry clien…
nidhiii-27 Oct 16, 2026
18b1e73
fix(storage): resolve review comments for client metrics infra
nidhiii-27 Oct 19, 2026
6e7a5c6
refactor(storage): preserve detectedAttributes in buildMeterProvider …
nidhiii-27 Oct 19, 2026
57fa64a
fix(metrics): update metric counter units to match Go SDK and design doc
nidhiii-27 Oct 20, 2026
f39f525
test(storage): deduplicate instrument nullability assertions in Stora…
nidhiii-27 Oct 20, 2026
a1f434d
test(storage): initialize InMemoryMetricReader in @Before and clean u…
nidhiii-27 Oct 20, 2026
4607b23
refactor(storage): remove misleading @VisibleForTesting from histogra…
nidhiii-27 Oct 20, 2026
97ed050
refactor(storage): remove gcp.storage.client.retries counter [Generat…
nidhiii-27 Oct 21, 2026
dc20d62
feat(storage): add OpenTelemetry client metrics configuration and opt…
nidhiii-27 Sep 23, 2026
07dcbb1
fix(storage): preserve meterProvider equality across toBuilder and se…
nidhiii-27 Sep 23, 2026
434948f
fix(storage): add deserialization guard for metricInterval and update…
nidhiii-27 Sep 30, 2026
327b558
fix(storage): address PR review comments for otel metrics config
nidhiii-27 Oct 8, 2026
517e61f
style(storage): format StorageOptions classes with fmt-maven-plugin
nidhiii-27 Oct 8, 2026
7f624a2
fix(storage): address review comments on otel metrics config
nidhiii-27 Oct 15, 2026
4f4f726
fix(storage): clamp metricInterval on deserialization and resolve rev…
nidhiii-27 Oct 19, 2026
9519e62
refactor(storage): address PR review comments for client metrics conf…
nidhiii-27 Oct 19, 2026
3d889a7
fix(storage): address review comments on PR #14484 for metrics option…
nidhiii-27 Oct 20, 2026
e7a3588
test(storage): deduplicate HTTP and gRPC test cases in StorageOptions…
nidhiii-27 Oct 20, 2026
ed62afa
feat(storage): add StorageErrorTypeMapper for standard metrics [Gener…
nidhiii-27 Oct 22, 2026
edb3def
feat(storage): add StorageMetricsContext for operation metrics state …
nidhiii-27 Oct 22, 2026
2b123b7
feat(storage): wire logical operation metrics in Retrying and Storage…
nidhiii-27 Oct 22, 2026
261bc60
feat(storage): wire operation metrics in HTTP veneer and storage chan…
nidhiii-27 Oct 22, 2026
354f72b
feat(storage): wire operation metrics in gRPC veneer [Generated-by: AI]
nidhiii-27 Oct 22, 2026
900248a
refactor(storage): address PR #14728 review comments on StorageMetric…
nidhiii-27 Oct 22, 2026
baba83d
Merge branch 'feat/storage-metrics-context' into feat/storage-logical…
nidhiii-27 Oct 22, 2026
a8f5f63
Merge branch 'feat/storage-logical-metrics' into feat/storage-veneer-…
nidhiii-27 Oct 22, 2026
75b0a0a
Merge branch 'feat/storage-veneer-operation-metrics' into feat/storag…
nidhiii-27 Oct 22, 2026
93b51b5
fix(storage): address PR #14729 review comments on gRPC veneer metric…
nidhiii-27 Oct 22, 2026
e5d17f3
chore(storage): remove unused helper and duplicate constant in Storag…
nidhiii-27 Oct 22, 2026
519a319
Merge branch 'feat/storage-metrics-context-error-mapping' into feat/s…
nidhiii-27 Oct 22, 2026
4728da2
feat(storage): add attempt recording methods to StorageMetricsContext…
nidhiii-27 Oct 22, 2026
aae49e7
Merge branch 'feat/storage-metrics-context' into feat/storage-logical…
nidhiii-27 Oct 22, 2026
f5d0dbe
feat(storage): bind metrics context to retrier and delegate attempt r…
nidhiii-27 Oct 22, 2026
dd9d51b
Merge branch 'feat/storage-logical-metrics' into feat/storage-veneer-…
nidhiii-27 Oct 22, 2026
de1def9
fix(storage): refine veneer operation metrics context propagation and…
nidhiii-27 Oct 22, 2026
230dc75
Merge branch 'feat/storage-veneer-operation-metrics' into feat/storag…
nidhiii-27 Oct 22, 2026
bb8cd41
fix(storage): refine gRPC veneer operation metrics and attempt tracking
nidhiii-27 Oct 22, 2026
74d10a6
fix(storage): gate status code extraction on rpcSystemName in attempt…
nidhiii-27 Oct 22, 2026
198a662
test(storage): consolidate StorageMetricsContextTest and remove unuse…
nidhiii-27 Oct 22, 2026
1be4eba
feat(storage): string-type HTTP response status code and set empty st…
nidhiii-27 Oct 22, 2026
88ef6d0
Merge branch 'main' into feat/storage-metrics-context-error-mapping
nidhiii-27 Oct 27, 2026
8a64086
fix(storage): address PR #14694 review comments in StorageErrorTypeMa…
nidhiii-27 Oct 27, 2026
011fdca
Merge branch 'feat/storage-metrics-context-error-mapping' into feat/s…
nidhiii-27 Oct 27, 2026
f1afc78
Merge branch 'feat/storage-metrics-context' into feat/storage-logical…
nidhiii-27 Oct 27, 2026
bf2048b
refactor(storage): address PR #14695 review comments and move metrics…
nidhiii-27 Oct 27, 2026
24f5c19
Merge branch 'feat/storage-logical-metrics' into feat/storage-veneer-…
nidhiii-27 Oct 27, 2026
98c266f
refactor(storage): use StorageClientMetrics for context creation in H…
nidhiii-27 Oct 27, 2026
7d02a9a
Merge branch 'feat/storage-veneer-operation-metrics' into feat/storag…
nidhiii-27 Oct 27, 2026
6b27e7f
refactor(storage): use StorageClientMetrics for context creation in g…
nidhiii-27 Oct 27, 2026
c998ce6
refactor(storage): polish StorageErrorTypeMapper cause unwrapping and…
nidhiii-27 Oct 27, 2026
ac31ae2
fix(storage): address PR #14695 review comments and readability impro…
nidhiii-27 Oct 29, 2026
1ee3ce0
fix(storage): resolve PR comments for StorageErrorTypeMapper
nidhiii-27 Oct 29, 2026
46a754f
fix(storage): preserve channel error state, prevent pagination/PCU ov…
nidhiii-27 Oct 29, 2026
36fea56
fix(storage): address review feedback on gRPC veneer operation metric…
nidhiii-27 Oct 29, 2026
3dbd4e6
fix(storage): address review feedback in StorageMetricsContext
nidhiii-27 Oct 29, 2026
295833d
fix(storage): replace StorageStub mock with static TestStorageStub fo…
nidhiii-27 Oct 29, 2026
cb8882a
fix(storage): declare gax-httpjson dependency in pom.xml
nidhiii-27 Oct 29, 2026
0d4cdde
fix(storage): remove unnecessary gax-httpjson dependency and reference
nidhiii-27 Oct 29, 2026
ac00bf4
fix(storage): mock UnaryCallable without annotations for Java 8 compa…
nidhiii-27 Oct 29, 2026
a008bbe
fix(storage): resolve PR comments for StorageMetricsContext
nidhiii-27 Nov 2, 2026
fd0a88f
fix(storage): address final PR review comments in StorageErrorTypeMapper
nidhiii-27 Nov 2, 2026
1244988
fix(storage): record NOT_FOUND on 404, suppress PCU sub-op metrics, a…
nidhiii-27 Nov 2, 2026
ce389ea
chore(storage): merge main to resolve spanner test compilation in gap…
nidhiii-27 Nov 2, 2026
dfdd5c4
refactor(storage): move mapGaxStatusCode helper below package-private…
nidhiii-27 Nov 2, 2026
eaa05b9
fix(storage): record UpdateBucket and UpdateObject metrics on no-op g…
nidhiii-27 Nov 2, 2026
1ed0bfc
fix(storage): harden status code extraction in StorageMetricsContext
nidhiii-27 Nov 2, 2026
e5aef73
fix(storage): record NOT_FOUND operation metrics on HTTP 404 and extr…
nidhiii-27 Nov 2, 2026
a2d2abd
fix(storage): address PR #14698 review comments on 404 attempt metric…
nidhiii-27 Nov 5, 2026
9dbb47e
fix(storage): record UpdateBucket and UpdateObject metrics on unmodif…
nidhiii-27 Nov 5, 2026
39a9734
Merge branch 'main' into feat/storage-metrics-context-error-mapping
Dhriti07 Nov 9, 2026
1de15fc
fix(storage): bound cause depth and simplify gRPC status delegation i…
nidhiii-27 Nov 9, 2026
1747bf4
Merge remote-tracking branch 'origin/feat/storage-metrics-context-err…
nidhiii-27 Nov 9, 2026
c0daeb7
refactor(storage): address review feedback on StorageMetricsContext
nidhiii-27 Nov 9, 2026
2fc50f6
chore(storage): merge main into feat/storage-metrics-context
nidhiii-27 Nov 9, 2026
85ee83f
fix(storage): use AttributeKey<Long> with 0L fallback for http.respon…
nidhiii-27 Nov 11, 2026
4e3b4a5
Merge branch 'feat/storage-metrics-context' into feat/storage-logical…
Dhriti07 Nov 11, 2026
a75f7ab
fix(storage): align StorageMetricsContext and tests after merging bas…
nidhiii-27 Nov 11, 2026
26ae991
chore(storage): merge main into feat/storage-logical-metrics
nidhiii-27 Nov 12, 2026
fd3c173
chore(storage): merge feat/storage-logical-metrics into feat/storage-…
nidhiii-27 Nov 12, 2026
e51bd60
chore(storage): merge feat/storage-veneer-operation-metrics into feat…
nidhiii-27 Nov 12, 2026
95ca816
Merge branch 'main' into feat/storage-logical-metrics
Dhriti07 Nov 12, 2026
56b54d6
Merge remote-tracking branch 'origin/feat/storage-logical-metrics' in…
nidhiii-27 Nov 12, 2026
a7647aa
fix(storage): unwrap IOException causing StorageException in channels…
nidhiii-27 Nov 12, 2026
558ee79
Merge branch 'feat/storage-veneer-operation-metrics' into feat/storag…
nidhiii-27 Nov 12, 2026
ab73edd
fix(storage): attach multiContext to write/query callables and drop r…
nidhiii-27 Nov 12, 2026
ab451f5
Merge remote-tracking branch 'origin/main' into feat/storage-veneer-o…
nidhiii-27 Nov 12, 2026
bc57699
fix(storage): short-circuit runNullable when metrics are off and lazi…
nidhiii-27 Nov 12, 2026
f1f55dc
Merge branch 'feat/storage-veneer-operation-metrics' into feat/storag…
nidhiii-27 Nov 12, 2026
af30054
Merge branch 'main' into feat/storage-grpc-veneer-operation-metrics
nidhiii-27 Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import com.google.cloud.storage.Retrying.RetrierWithAlg;
import com.google.storage.v2.RewriteObjectRequest;
import com.google.storage.v2.RewriteResponse;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
final class GapicCopyWriter extends CopyWriter {

// needed for #getResult
Expand All @@ -32,27 +35,45 @@ final class GapicCopyWriter extends CopyWriter {
private final RetrierWithAlg retrier;
private final RewriteObjectRequest originalRequest;
private final RewriteResponse initialResponse;
@Nullable private final StorageMetricsContext metricsContext;
Comment thread
nidhiii-27 marked this conversation as resolved.
Resolved

private RewriteResponse mostRecentResponse;
private boolean operationRecorded;

GapicCopyWriter(
GrpcStorageImpl storage,
UnaryCallable<RewriteObjectRequest, RewriteResponse> callable,
RetrierWithAlg retrier,
RewriteObjectRequest originalRequest,
RewriteResponse initialResponse) {
RewriteResponse initialResponse,
@Nullable StorageMetricsContext metricsContext) {
this.storage = storage;
this.callable = callable;
this.retrier = retrier;
this.initialResponse = initialResponse;
this.mostRecentResponse = initialResponse;
this.originalRequest = originalRequest;
this.metricsContext = metricsContext;
this.operationRecorded = initialResponse.getDone();
}

private void recordOperation(@Nullable Throwable error) {
if (metricsContext != null && !operationRecorded) {
metricsContext.recordOperation(storage.getOptions().getStorageClientMetrics(), error);
operationRecorded = true;
}
}

@Override
public Blob getResult() {
while (!isDone()) {
copyChunk();
try {
while (!isDone()) {
copyChunk();
}
recordOperation(null);
} catch (Throwable t) {
recordOperation(t);
throw t;
}
BlobInfo info = Conversions.grpc().blobInfo().decode(mostRecentResponse.getResource());
return info.asBlob(storage);
Expand All @@ -76,10 +97,25 @@ public long getTotalBytesCopied() {
@Override
public void copyChunk() {
if (!isDone()) {
RewriteObjectRequest req =
originalRequest.toBuilder().setRewriteToken(mostRecentResponse.getRewriteToken()).build();
GrpcCallContext retryContext = Retrying.newCallContext();
mostRecentResponse = retrier.run(() -> callable.call(req, retryContext), Decoder.identity());
try {
RewriteObjectRequest req =
originalRequest.toBuilder()
.setRewriteToken(mostRecentResponse.getRewriteToken())
.build();
StorageMetricsContext chunkContext = metricsContext;
GrpcCallContext retryContext = Retrying.newCallContext(chunkContext);
RewriteResponse resp =
retrier.run(() -> callable.call(req, retryContext), Decoder.identity(), chunkContext);
if (resp != null) {
mostRecentResponse = resp;
}
if (isDone()) {
recordOperation(null);
}
} catch (Throwable t) {
recordOperation(t);
throw t;
}
}
}
Comment thread
nidhiii-27 marked this conversation as resolved.
Resolved

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.storage.v2.ReadObjectRequest;
import com.google.storage.v2.ReadObjectResponse;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jspecify.annotations.Nullable;

final class GrpcBlobReadChannel extends BaseStorageReadChannel<Object> {

Expand All @@ -41,7 +42,18 @@ final class GrpcBlobReadChannel extends BaseStorageReadChannel<Object> {
ResultRetryAlgorithm<?> resultRetryAlgorithm,
ReadObjectRequest request,
boolean autoGzipDecompression) {
super(Conversions.grpc().blobInfo());
this(read, retrier, resultRetryAlgorithm, request, autoGzipDecompression, null, null);
}

GrpcBlobReadChannel(
ZeroCopyServerStreamingCallable<ReadObjectRequest, ReadObjectResponse> read,
Retrier retrier,
ResultRetryAlgorithm<?> resultRetryAlgorithm,
ReadObjectRequest request,
boolean autoGzipDecompression,
@Nullable StorageMetricsContext metricsContext,
@Nullable StorageClientMetrics storageClientMetrics) {
super(Conversions.grpc().blobInfo(), metricsContext, storageClientMetrics);
this.read = read;
this.retrier = retrier;
this.resultRetryAlgorithm = resultRetryAlgorithm;
Expand All @@ -61,7 +73,8 @@ protected LazyReadChannel<?, Object> newLazyReadChannel() {
ReadableByteChannelSessionBuilder b =
ResumableMedia.gapic()
.read()
.byteChannel(read, retrier, resultRetryAlgorithm)
.byteChannel(
read, retrier.withMetricsContext(getMetricsContext()), resultRetryAlgorithm)
.setHasher(Hasher.readHasher())
.setAutoGzipDecompression(autoGzipDecompression);
BufferHandle bufferHandle = getBufferHandle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.storage.v2.WriteObjectRequest;
import com.google.storage.v2.WriteObjectResponse;
import java.util.function.Supplier;
import org.jspecify.annotations.Nullable;

final class GrpcBlobWriteChannel extends BaseStorageWriteChannel<WriteObjectResponse> {

Expand All @@ -37,7 +38,20 @@ final class GrpcBlobWriteChannel extends BaseStorageWriteChannel<WriteObjectResp
RetrierWithAlg retrier,
Supplier<ApiFuture<ResumableWrite>> start,
Hasher hasher) {
super(Conversions.grpc().blobInfo().compose(WriteObjectResponse::getResource));
this(write, retrier, start, hasher, null, null);
}

GrpcBlobWriteChannel(
ClientStreamingCallable<WriteObjectRequest, WriteObjectResponse> write,
RetrierWithAlg retrier,
Supplier<ApiFuture<ResumableWrite>> start,
Hasher hasher,
@Nullable StorageMetricsContext metricsContext,
@Nullable StorageClientMetrics storageClientMetrics) {
super(
Conversions.grpc().blobInfo().compose(WriteObjectResponse::getResource),
metricsContext,
storageClientMetrics);
this.write = write;
this.retrier = retrier;
this.start = start;
Expand Down
Loading
Loading