Skip to content

fix(bigtable): fix authentication scopes for metrics exporter - #18609

Merged
parthea merged 2 commits into
mainfrom
fix_metrics_client_scopes_bigtable_metrics-exporter-scopes
Oct 9, 2026
Merged

parthea merged 2 commits into
mainfrom
fix_metrics_client_scopes_bigtable_metrics-exporter-scopes

Conversation

@daniel-sanche

Copy link
Copy Markdown
Contributor

The Bigtable client holds an inner Metrics client, for exporting client-side metrics. This inner-client shares credentials with the Bigtable client. If the Bigtable client is created with scopes that don't allow interacting with the metrics service, the metrics client will fail on each write, printing logs each time

This PR addresses the issue by:

  • attempting to add a new scope to the metrics client, before creation
  • disabling the exporter on the first auth failure, so it doesn't send excessive logs if it can't authenticate properly

@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 introduces credential re-scoping for the Cloud Monitoring metrics exporter to prevent authentication failures when using credentials pinned to Bigtable-only scopes. It also adds a mechanism to disable the exporter after encountering non-retryable authentication or authorization errors, along with comprehensive unit tests. The review feedback highlights three key improvement opportunities: using 'getattr' to safely access the 'scopes' attribute on 'Scoped' credentials to avoid potential 'AttributeError's, handling credentials passed as positional arguments in 'client_args', and returning 'MetricExportResult.SUCCESS' instead of 'FAILURE' when the exporter is disabled to completely silence OpenTelemetry SDK warning logs.

@daniel-sanche
daniel-sanche marked this pull request as ready for review October 9, 2026 02:00
@daniel-sanche
daniel-sanche requested a review from a team as a code owner October 9, 2026 02:00
@daniel-sanche
daniel-sanche marked this pull request as draft October 9, 2026 02:00
@daniel-sanche
daniel-sanche marked this pull request as ready for review October 9, 2026 02:19
@parthea
parthea merged commit 722d34e into main Oct 9, 2026
55 checks passed
@parthea
parthea deleted the fix_metrics_client_scopes_bigtable_metrics-exporter-scopes branch October 9, 2026 13:40
@release-please release-please Bot mentioned this pull request Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants