fix(spanner): set gauge metric start time to match end time#14289
fix(spanner): set gauge metric start time to match end time#14289sakthivelmanii merged 1 commit intomainfrom
Conversation
51dbbb8 to
ed415d3
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the Spanner metrics configuration to use default aggregation and introduces a new test case, TestBuiltinMetrics_GaugeAggregation, to verify gauge aggregation and attribute filtering. The review feedback suggests improving test stability by replacing a hardcoded sleep with a polling mechanism and removing a redundant manual exporter stop call while ensuring the meter provider shutdown uses a non-cancelable context.
ed415d3 to
2c99011
Compare
This commit fixes an InvalidArgument error ("One or more points were written
more frequently than the maximum sampling period") when exporting gauge metrics
like `open_connections` to Cloud Monitoring.
Previously, the time interval for these gauge metrics started from the moment
the application booted up. This created long, continuously overlapping time
intervals. Cloud Monitoring strictly rejected these because it requires gauges
to be exact, point-in-time measurements, not long durations.
By simply setting the start time equal to the end time (`start = end`), we
correctly format the data as instantaneous point-in-time snapshots. This
satisfies Cloud Monitoring's requirements and allows the metrics to export
successfully on every cycle.
82b5d26 to
9db9693
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request modifies the toNonemptyTimeIntervalpb function in spanner/metrics_monitoring_exporter.go to set the start time equal to the end time for gauge metrics, ensuring compliance with the Cloud Monitoring API requirements for time intervals. I have no feedback to provide as no review comments were submitted.
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v0.10.1 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian-go@sha256:b04b076f5eedbb5546bd6fc1404969dd3698c8b19c0f34ae815a84ae735a606a <details><summary>spanner: v1.90.0</summary> ## [v1.90.0](spanner/v1.89.0...spanner/v1.90.0) (2026-04-14) ### Features * feat(spanner): add EnableDirectAccess field to ClientConfig (#14287) ([6adf5b7](6adf5b7)) * feat(spanner): Switch to using builtin open telemetry for EEF (#14193)([751febd](751febd)) * feat(spanner): complete location-aware routing resilience and observability (#14418 ) ([77aa4df](77aa4df)) ### Bug Fixes * fix(spanner): set gauge metric start time to match end time (#14289) ([e0760b5](e0760b5)) * fix(spanner): update DirectPath detection logic to use ALTS credentials(#14288)([3cd5716](3cd5716)) </details>
This commit fixes an InvalidArgument error ("One or more points were written
more frequently than the maximum sampling period") when exporting gauge metrics
like
open_connectionsto Cloud Monitoring.Previously, the time interval for these gauge metrics started from the moment
the application booted up. This created long, continuously overlapping time
intervals. Cloud Monitoring strictly rejected these because it requires gauges
to be exact, point-in-time measurements, not long durations.
By simply setting the start time equal to the end time (
start = end), wecorrectly format the data as instantaneous point-in-time snapshots. This
satisfies Cloud Monitoring's requirements and allows the metrics to export
successfully on every cycle.