Repository navigation
feat(storage): add gcp.storage.client.ttfb metric for read operations - #14745
nidhiii-27 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds Time to First Byte (TTFB) metrics tracking for both gRPC and HTTP storage clients, along with corresponding unit tests. The feedback highlights a potential NullPointerException in StorageGrpcMetricsInterceptor due to a missing null check in onClose when rpcClientCallDuration is null, and suggests restricting HTTP TTFB recording to 2xx status codes to prevent misleading metrics on 3xx responses.
There was a problem hiding this comment.
Code Review
This pull request introduces Time to First Byte (TTFB) metrics tracking for both gRPC and HTTP Google Cloud Storage clients, along with comprehensive unit tests. The feedback highlights a potential NullPointerException in the gRPC interceptor if call duration metrics are disabled while TTFB is enabled, and suggests a refactoring to safely guard against this. Additionally, an optimization is suggested for the HTTP interceptor to avoid registering response interceptors when no metrics need to be recorded.
…ceptor checks Use KEY_GCP_STORAGE_OPERATION (ReadObject) for gcp.storage.client.ttfb across gRPC and HTTP interceptors, restrict HTTP TTFB recording to 2xx status codes, hoist recordDuration/recordTtfb checks, and expand unit test coverage. [Generated-by: AI]
Instruments read operations across gRPC and HTTP transports to record
gcp.storage.client.ttfb(time to first byte) OpenTelemetry histogram metrics.ReadObjectandBidiReadObjectinStorageGrpcMetricsInterceptorwithrpc.system.name,gcp.storage.operation(ReadObject),network.path, andserver.addressattributes.2xxresponse headers on media download requests inStorageHttpMetricsInterceptor.StorageGrpcMetricsInterceptorTestandStorageHttpMetricsInterceptorTest.Stacked on #14744.