Repository navigation
feat(storage): wire veneer operation metrics in StorageImpl and GrpcStorageImpl - #14698
nidhiii-27 wants to merge 4 commits into
Conversation
…torageImpl - Wire operation-level metrics context across GrpcStorageImpl and StorageImpl - Wire RewriteObject metrics context in GapicCopyWriter.copyChunk() - Map operation names matching Go SDK / HLD PascalCase specification (CreateBucket, ListBuckets, GetBucket, UpdateBucket, DeleteBucket, LockBucketRetentionPolicy, ListObjects, GetObject, UpdateObject, DeleteObject, RestoreObject, ComposeObject, RewriteObject, MoveObject, WriteObject, ReadObject, GetIamPolicy, SetIamPolicy, TestIamPermissions, GetServiceAccount, CreateHMACKey, GetHMACKey, ListHMACKeys, UpdateHMACKey, DeleteHMACKey, CreateNotification, GetNotification, ListNotifications, DeleteNotification, GetBucketACL, DeleteBucketACL, CreateBucketACL, UpdateBucketACL, ListBucketACLs, GetDefaultObjectACL, DeleteDefaultObjectACL, CreateDefaultObjectACL, UpdateDefaultObjectACL, ListDefaultObjectACLs, GetObjectACL, DeleteObjectACL, CreateObjectACL, UpdateObjectACL, ListObjectACLs) - Explicitly merge GrpcCallContext with Retrying.newCallContext(metricsContext) across all unary/call sites in GrpcStorageImpl without wrapper helpers - Supply metrics context in pagination decorators (TransformingPageDecorator, ListObjectsWithSyntheticDirectoriesPage, ListBucketsWithPartialSuccessPage) - Leave streaming channel methods untouched for follow-up PR [Generated-by: AI]
…operation-metrics
There was a problem hiding this comment.
Code Review
This pull request integrates StorageMetricsContext across various storage operations in GrpcStorageImpl, StorageImpl, and GapicCopyWriter to enable operation-specific metrics tracking. However, in GrpcStorageImpl.java's moveBlob method, the metricsContext is passed to the retrier but is not merged into the GrpcCallContext or passed to the moveObjectCallable call, which prevents proper propagation of the metrics context to the gRPC request.
| StorageMetricsContext metricsContext = getOptions().createMetricsContext("MoveObject"); | ||
| return retrier.run( | ||
| retryAlgorithmManager.getFor(req), | ||
| () -> storageClient.moveObjectCallable().call(req), | ||
| syntaxDecoders.blob); | ||
| syntaxDecoders.blob, | ||
| metricsContext); |
There was a problem hiding this comment.
In moveBlob, the metricsContext is created and passed to retrier.run, but it is not merged into the GrpcCallContext and passed to storageClient.moveObjectCallable().call(req). This means the metrics context will not be propagated to the actual gRPC request headers/metadata. We should merge grpcCallContext with Retrying.newCallContext(metricsContext) and pass the merged context to the callable, matching the pattern used in all other methods in this class.
StorageMetricsContext metricsContext = getOptions().createMetricsContext("MoveObject");
GrpcCallContext merge = Utils.merge(grpcCallContext, Retrying.newCallContext(metricsContext));
return retrier.run(
retryAlgorithmManager.getFor(req),
() -> storageClient.moveObjectCallable().call(req, merge),
syntaxDecoders.blob,
metricsContext);…operation-metrics
- Pass serviceOptions.createMetricsContext("RewriteObject") in copyChunk()
- Use serviceOptions.asRetryDependencies() in StateImpl.restore()
- Add test in CopyWriterTest to verify RewriteObject metrics context is passed
[Generated-by: AI]
Description
This PR is stacked on top of #14695 (
feat/storage-logical-metrics).It wires operation-level metrics context across
GrpcStorageImpl(gRPC transport),StorageImpl(HTTP transport), andGapicCopyWriter, matching the exact Go SDK / HLD PascalCase operation names (google-cloud-go/storage/metrics.go:1319–1580).Summary of Changes:
GapicCopyWriter.java:"RewriteObject"StorageMetricsContexttoRetrying.newCallContext(metricsContext)and passed toretrier.run(...)during chunk copy iterations.GrpcStorageImpl.java:GrpcCallContextwithRetrying.newCallContext(metricsContext)across all unary and non-streaming call sites (getOptions().createMetricsContext("<OperationName>")).TransformingPageDecoratorto accept aSupplier<StorageMetricsContext>and supply fresh metrics context oniterateAll().ListObjectsWithSyntheticDirectoriesPage.getNextPage()with"ListObjects"metrics context.StorageImpl.java:run(...)with 4-argrun(String operationName, ResultRetryAlgorithm<?> algorithm, Callable<T> c, Decoder<T, U> f)mapping togetOptions().createMetricsContext(operationName).listBuckets,listBlobs,listHmacKeys).[Generated-by: AI]