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

Testing: disable looking up GCP credentials #9900

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

snazy
Copy link
Member

@snazy snazy commented Nov 11, 2024

This is a follow-up of #9866 (and it's revert #9899). The stack traces indicate that the global-tracer field init race happens when BigTableBackendBuilder tries to fetch the GCP credentials via Instance<CredentialsProvider>, which eventually lets the Google client try to find the default app-credentials, which then implicitly initializes OpenCensus->OpenTelemetry.

The workaround here is to add a new undocumented configuration option to disable GCP credentials lookup, which is also not necessary when using the BT emulator.

This is a follow-up of projectnessie#9866 (and it's revert projectnessie#9899). The stack traces indicate that the global-tracer field init race happens when `BigTableBackendBuilder` tries to fetch the GCP credentials via `Instance<CredentialsProvider>`, which eventually lets the Google client try to find the default app-credentials, which then implicitly initializes OpenCensus->OpenTelemetry.

The workaround here is to add a new undocumented configuration option to disable GCP credentials lookup, which is also not necessary when using the BT emulator.
@snazy snazy added this to the 0.100.0 milestone Nov 11, 2024
@snazy snazy requested a review from dimas-b November 11, 2024 15:11
googleCredentialsException = e;
// The disableCredentialsLookupForTests() is only used for tests and only to prevent the
// OpenTelemetry/global-tracer static-field initialization race described in #9866
if (!bigTableConfig.disableCredentialsLookupForTests()) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure "ForTests" actually adds any guardrails, but it makes the java code look odd. Could you name the java method simply as disableCredentialsLookup()? I suppose end users will get enough warning from having "credentials" in the name.

Copy link
Member

Choose a reason for hiding this comment

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

... and of course, we'll keep it undocumented (other than javadoc)

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it really matter? The parameter won't show up in any documentation

Copy link
Member

Choose a reason for hiding this comment

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

IMHO, the code reads awkwardly, but up to you :)

googleCredentialsException = e;
// The disableCredentialsLookupForTests() is only used for tests and only to prevent the
// OpenTelemetry/global-tracer static-field initialization race described in #9866
if (!bigTableConfig.disableCredentialsLookupForTests()) {
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, the code reads awkwardly, but up to you :)

@snazy snazy merged commit ae91af4 into projectnessie:main Nov 11, 2024
16 checks passed
@snazy snazy deleted the disable-gcp-credentials-in-tests branch November 11, 2024 17:50
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