Skip to content

fix(bigtable): default cluster/zone in toOtelMetricAttrs to avoid Monitoring reject - #20178

Merged
sushanb merged 1 commit into
googleapis:mainfrom
sushanb:fix-bigtable-metrics-default-location
Jul 21, 2026
Merged

fix(bigtable): default cluster/zone in toOtelMetricAttrs to avoid Monitoring reject#20178
sushanb merged 1 commit into
googleapis:mainfrom
sushanb:fix-bigtable-metrics-default-location

Conversation

@sushanb

@sushanb sushanb commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Cloud Monitoring rejects bigtable_client_raw writes with an empty
zone/cluster ("Unrecognized region or location"). Empty values reach
toOtelMetricAttrs when an attempt errors before response headers/trailers
arrive (e.g. DEADLINE_EXCEEDED on the first attempt), so ExtractLocation
never runs and there's no lastClusterID / lastZoneID to fall back on.

Coerce empty → defaultCluster / defaultZone unconditionally before assembling
the resource labels, matching the fallback ExtractLocation already returns
on failure (<unspecified> / global).

Test plan

  • go build ./bigtable/internal/metrics/...
  • go test ./bigtable/internal/metrics/... -count=1

…itoring reject

Cloud Monitoring rejects bigtable_client_raw writes with an empty
zone/cluster ("Unrecognized region or location"). Empty values reach
toOtelMetricAttrs when an attempt errors before response headers/trailers
arrive (e.g. DEADLINE_EXCEEDED on the first attempt), so ExtractLocation
never runs and there's no lastClusterID/lastZoneID to fall back on.

Coerce empty -> defaultCluster/defaultZone unconditionally before assembling
the resource labels, matching the fallback ExtractLocation already returns
on failure.
@sushanb
sushanb requested review from a team as code owners July 20, 2026 20:35
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Jul 20, 2026

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

Copy link
Copy Markdown
Contributor

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 updates bigtable/internal/metrics/tracer.go to fall back to defaultCluster and defaultZone when clusterID and zoneID are empty. This prevents Cloud Monitoring from rejecting bigtable_client_raw writes when an attempt errors before response headers/trailers arrive. There are no review comments, so I have no feedback to provide.

Comment thread bigtable/internal/metrics/tracer.go
@sushanb
sushanb merged commit 14493f4 into googleapis:main Jul 21, 2026
19 checks passed
hongalex pushed a commit that referenced this pull request Jul 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.51.0](bigtable/v1.50.0...bigtable/v1.51.0)
(2026-07-23)


### Features

* **bigtable:** Add ChainInterceptors and RetryingVRpc for vRPC pipeline
([#20185](#20185))
([c7a832a](c7a832a))
* **bigtable:** Add ClientConfigurationManager
([#19986](#19986))
([3a8f927](3a8f927))
* **bigtable:** Add debug tag counter (recordDebugTag / assertDebugTag)
([#20114](#20114))
([3c97590](3c97590))
* **bigtable:** Add lazyPool helper for on-demand session pool opening
([#20182](#20182))
([f6ae3fb](f6ae3fb))
* **bigtable:** Add PeakEwma continuous time-decay latency tracker
([#20187](#20187))
([9d124ef](9d124ef))
* **bigtable:** Add PoolSizer for server-driven session pool capacity
([#20189](#20189))
([57ebbeb](57ebbeb))
* **bigtable:** Add session package with SessionClient + SessionTableAPI
interfaces
([#20180](#20180))
([4b82fd2](4b82fd2))
* **bigtable:** Add Session primitives (AttemptOutcome, vRPC ctx,
msgtype)
([#20116](#20116))
([e1011e2](e1011e2))
* **bigtable:** Add Session state enum
([#19981](#19981))
([0748972](0748972))
* **bigtable:** Add SessionThrottler / AdaptiveSessionThrottler for
OpenSession pacing
([#20184](#20184))
([02e3c6d](02e3c6d))
* **bigtable:** Add SessionThrottler / AdaptiveSessionThrottler for
OpenSession pacing
([#20184](#20184))
([29be83e](29be83e))
* **bigtable:** Add sessionTracer for per-Session lifecycle + vRPC
metrics
([#20190](#20190))
([a466345](a466345))
* **bigtable:** Enable new auth library and JWT for instance admin
client
([#20013](#20013))
([21c4a44](21c4a44))
* **bigtable:** Modularize channel priming behind a ChannelPrimer
interface
([#20027](#20027))
([5214ab7](5214ab7))
* **bigtable:** Modularize Direct Access compatibility check
([#19987](#19987))
([a25e93d](a25e93d))
* **o11y:** Regenerate clients for LRO tracing
([#20107](#20107))
([779074e](779074e))


### Bug Fixes

* **bigtable:** Default cluster/zone in toOtelMetricAttrs to avoid
Monitoring reject
([#20178](#20178))
([14493f4](14493f4))
* **bigtable:** Eliminate stats-handler MD race in internal/metrics
tracer
([#20158](#20158))
([c387066](c387066))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants