chore(spanner): add initial setup for built-in metrics#5967
Conversation
Sets up the initial boiler-plate code for adding built-in metrics for Spanner. The feature is hidden behind a feature flag, meaning that it is currently invisible to customers.
There was a problem hiding this comment.
Code Review
This pull request introduces an experimental built-in metrics and observability framework for the Spanner client, adding dependencies on google-cloud-monitoring-v3 and opentelemetry to trace database operations. The reviewer feedback focuses on managing these new dependencies via cfg(google_cloud_unstable_tracing) flags instead of standard Cargo features to prevent dependency bloat, and conditionally compiling the observability module. Additionally, the reviewer recommends optimizing performance by using &'static str for method names to avoid unnecessary string allocations, and improving the robustness of the Server-Timing header parser to handle parameters in any order, along with adding corresponding test cases.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5967 +/- ##
==========================================
- Coverage 97.71% 97.63% -0.09%
==========================================
Files 242 244 +2
Lines 60976 61243 +267
==========================================
+ Hits 59582 59792 +210
- Misses 1394 1451 +57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces observability and metrics support to the Spanner client, integrating OpenTelemetry and exporting metrics to Google Cloud Monitoring under the google_cloud_unstable_tracing feature flag. The review feedback highlights critical compilation errors in metrics.rs regarding universe_domain cloning and tonic::Status code retrieval, as well as a potential lifetime issue in the define_idempotent_rpc macro closure. Additionally, improvements are suggested to preserve universe domain resolution by not hardcoding the monitoring endpoint, use the crate name for the meter, enhance readability in server timing parsing, and adhere to the repository's 'return early' style guide in parse_project_id.
6589d88 to
abbeb89
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces observability and metrics tracking to the Spanner client using OpenTelemetry and Google Cloud Monitoring. It adds a new observability module, defines Spanner-specific metrics (such as operation and attempt latencies), and integrates these metrics across various transactions and client operations. The review feedback suggests optimizing environment variable parsing in metrics.rs by using eq_ignore_ascii_case instead of to_lowercase() to avoid unnecessary string allocations.
abbeb89 to
42bbe04
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces observability and metrics tracking to the Spanner client under the google_cloud_unstable_tracing feature flag, integrating OpenTelemetry and Google Cloud Monitoring to record operation and attempt latencies. The review feedback highlights a critical compilation error in the status-to-string mapping due to private tonic::Status fields and a missing name() method on tonic::Code. Additionally, it is recommended to propagate more configuration options, such as the emulator endpoint, from ClientConfig when initializing the monitoring service.
42bbe04 to
ee92ecb
Compare
|
/gemini review |
ee92ecb to
0fb4b96
Compare
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
0fb4b96 to
f599240
Compare
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Sets up the initial boiler-plate code for adding built-in metrics for Spanner.
The feature is hidden behind a feature flag, meaning that it is currently invisible to customers.