-
Notifications
You must be signed in to change notification settings - Fork 129
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
Testing: disable looking up GCP credentials #9900
Conversation
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.
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()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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 :)
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 viaInstance<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.