Skip to content

feat(storage): add stream open latency metrics and trace annotations - #16316

Open
kalragauri wants to merge 4 commits into
googleapis:feat/storage-experimental-metricsfrom
kalragauri:feat/storage-experimental-metrics
Open

feat(storage): add stream open latency metrics and trace annotations#16316
kalragauri wants to merge 4 commits into
googleapis:feat/storage-experimental-metricsfrom
kalragauri:feat/storage-experimental-metrics

Conversation

@kalragauri

Copy link
Copy Markdown
Contributor

This PR captures microsecond timestamps across connection establishment, request dispatch, and metadata response receipt, exporting them to OpenTelemetry histograms and adding trace span event annotations. Follow-up PRs will add metrics for other required paths.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Aug 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces OpenTelemetry metrics and tracing to track network handshake, server metadata, and end-to-end stream open latencies in OpenObject. The review feedback highlights several critical issues regarding conditional compilation: using an invalid OpenTelemetry API call instead of the SDK's internal CurrentSpan() function, and unconditionally declaring/assigning time-tracking variables (t0_, t1_, t2_, and t3) which introduces unnecessary overhead and triggers compiler warnings when metrics are disabled. Wrapping these variables and assignments in the appropriate preprocessor guards is recommended.

Comment thread google/cloud/storage/internal/async/open_object.cc
Comment thread google/cloud/storage/internal/async/open_object.cc Outdated
Comment thread google/cloud/storage/internal/async/open_object.cc
Comment thread google/cloud/storage/internal/async/open_object.cc
Comment thread google/cloud/storage/internal/async/open_object.h Outdated
@kalragauri
kalragauri force-pushed the feat/storage-experimental-metrics branch from 99f81ee to 73bfe50 Compare August 4, 2026 11:33
@kalragauri
kalragauri marked this pull request as ready for review August 4, 2026 11:44
@kalragauri
kalragauri requested review from a team as code owners August 4, 2026 11:44
@kalragauri
kalragauri requested a review from v-pratap August 4, 2026 11:45
Comment thread google/cloud/storage/internal/async/open_object.cc Outdated
Comment thread google/cloud/storage/internal/async/open_object.h
Comment thread google/cloud/storage/internal/async/open_object.cc Outdated
@kalragauri
kalragauri force-pushed the feat/storage-experimental-metrics branch 2 times, most recently from 3bf2f94 to b03de2f Compare August 6, 2026 08:10
@kalragauri
kalragauri force-pushed the feat/storage-experimental-metrics branch from b03de2f to 68e2792 Compare August 6, 2026 08:23
@kalragauri

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces latency metrics and tracing span events for asynchronous open object operations by adding the OpenObjectMetrics class and integrating it into OpenObject. The review feedback correctly identifies that tracing span events are currently tightly coupled with the metrics compilation flag (GOOGLE_CLOUD_CPP_STORAGE_WITH_OTEL_METRICS). To ensure tracing works independently of metrics, the reviewer suggests decoupling the timestamp tracking and span event recording so they are active when either tracing (GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY) or metrics is enabled.

Comment thread google/cloud/storage/internal/async/open_object_metrics.h
Comment thread google/cloud/storage/internal/async/open_object_metrics.cc
Comment thread google/cloud/storage/internal/async/open_object_metrics.cc
@kalragauri
kalragauri requested a review from bajajneha27 August 6, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants