Skip to content

feat(storage): add range read latency metrics and trace annotations - #16353

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

feat(storage): add range read latency metrics and trace annotations#16353
kalragauri wants to merge 3 commits into
googleapis:feat/storage-experimental-metricsfrom
kalragauri:feat/storage-experimental-metrics

Conversation

@kalragauri

Copy link
Copy Markdown
Contributor

Key changes in this PR:

  • Extracts t4, t5, t6, and t7 timestamps from async payload reads to calculate queue, network, and internal latency timings.
  • Records timings into three new gl-cpp.latency.bidi_read.* DoubleHistograms, which are protected by GOOGLE_CLOUD_CPP_STORAGE_WITH_OTEL_METRICS.
  • In addition to histograms, latency timings are recorded directly onto the active read span as gl-cpp.latency.read events.

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

@gemini-code-assistgemini-code-assistBot 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 telemetry and metrics collection for asynchronous reader connections in the Google Cloud Storage C++ client, adding ReaderConnectionTelemetry to record queue, network, and internal overhead latencies using OpenTelemetry. It updates various tracing classes to propagate bucket names and record read latency metrics, fixes a locking issue in ReadRange, and adds unit tests. The reviewer feedback focuses on enforcing repository style guide rules, specifically replacing absl::string_view with std::string_view, avoiding auto where it obscures domain objects, StatusOr, function return types, or primitive types, improving header includes, and using more idiomatic checks for std::chrono::steady_clock::time_point initialization.

Comment threadgoogle/cloud/storage/internal/async/connection_tracing.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/connection_tracing.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/object_descriptor_reader_tracing.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.h Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.h Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_tracing.cc Outdated
@kalragauri

Copy link
Copy Markdown
ContributorAuthor

/gemini review

@gemini-code-assistgemini-code-assistBot 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 'ReaderConnectionTelemetry' to record read latency metrics and trace events, integrating it into 'AsyncReaderConnectionTracing' and 'ObjectDescriptorReaderTracing' while passing the bucket name through the tracing pipeline. It also fixes a mutex locking issue in 'ReadRange'. The review feedback recommends avoiding a process-global static 'ReadLatencyMetrics' to respect client-specific 'MeterProvider' configurations, and suggests adding defensive checks to ensure timestamps are monotonically ordered before recording latency.

Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.cc Outdated
Comment threadgoogle/cloud/storage/internal/async/reader_connection_telemetry.cc Outdated
@kalragauri
kalragauriforce-pushed the feat/storage-experimental-metrics branch from 9a3fcc9 to 3c6a274CompareAugust 18, 2026 06:44
@kalragauri
kalragauri marked this pull request as ready for review August 18, 2026 06:45
@kalragauri
kalragauri requested review from a team as code ownersAugust 18, 2026 06:45
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storageIssues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kalragauri