Skip to content

fix(bigtable): avoid DuplicateCredentialArgs in BigtableMetricsExporter - #18927

Closed
mutianf wants to merge 2 commits into
fix-credentials-file-projectfrom
fix-metrics-exporter-credentials-file
Closed

mutianf wants to merge 2 commits into
fix-credentials-file-projectfrom
fix-metrics-exporter-credentials-file

Conversation

@mutianf

@mutianf mutianf commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

When credentials and client_options with credentials_file or api_key are both passed to BigtableMetricsExporter, strip credentials_file and api_key from a shallow copy of client_options before initializing MetricServiceClient.
@mutianf
mutianf added this pull request to stack #18928 October 30, 2026 16:23
@mutianf
mutianf requested a review from a team as a code owner October 30, 2026 16:23

@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 the BigtableMetricsExporter initialization to prevent raising DuplicateCredentialArgs and mutating the caller's client_options when both resolved credentials and client_options (containing credentials_file or api_key) are provided. It handles both dictionary and ClientOptions object types, and includes corresponding unit tests. The review feedback highlights an inconsistency in how these two types are checked—using truthiness for dictionaries and explicit is not None checks for objects—and suggests standardizing on is not None checks for both to ensure consistent behavior.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mutianf

mutianf commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

This is probably fine. If it fails it would fail loud.

@mutianf mutianf closed this Oct 30, 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.

1 participant