Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: disable native metrics when there are no credentials #3567

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

olavloite
Copy link
Collaborator

Native metrics were automatically disabled when the emulator is used, but some clients (e.g. PGAdapter) set up the connection to the emulator manually instead of setting the environment variable. Also, when using in-mem mock servers, native metrics should be disabled, as they cannot be exported.

This PR therefore adds an additional check that disables native metrics when the client uses a NoCredentials instance.

Native metrics were automatically disabled when the emulator is used, but
some clients (e.g. PGAdapter) set up the connection to the emulator manually
instead of setting the environment variable. Also, when using in-mem mock
servers, native metrics should be disabled, as they cannot be exported.

This PR therefore adds an additional check that disables native metrics
when the client uses a NoCredentials instance.
@olavloite olavloite requested a review from a team as a code owner December 18, 2024 14:45
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner API. labels Dec 18, 2024
@@ -1791,6 +1792,10 @@ public CallCredentialsProvider getCallCredentialsProvider() {
return callCredentialsProvider;
}

public boolean usesNoCredentials() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really have to be public? one usage is within this file itself. Can we make it private?

@olavloite olavloite merged commit dfc154e into main Dec 18, 2024
33 of 34 checks passed
@olavloite olavloite deleted the disable-metrics-without-credentials branch December 18, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants