-
Notifications
You must be signed in to change notification settings - Fork 34
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
Prevent the usage of OpenTelemetry in GcpDefaultsConfigSourceFactory #487
Conversation
This is needed because GcpDefaultsConfigSourceFactory is called very early in the application startup and can thus mess up the OpenTelemetry configuration performed later by Quarkus Fixes: quarkusio/quarkus#35500
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.
This seems to be the same fix used in quarkusio/quarkus#22864
for the Google client.
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.
LGTM
@all-contributors please add @geoand for code |
I've put up a pull request to add @geoand! 🎉 |
@loicmathieu could you cut a release so that we have one fully compatible with 3.3? |
@gsmet yes, I'll do it today if I find the time. |
Sorry, but this still happens w/ 3.3.1 (via the platform-bom). Reproducer in this manually updated PR (use
Edit: quarkiverse/googlecloudservices 2.4.0 is being used |
The odd thing is that I can't reproduce the problem in the integration tests of this module... In any case, we might also need to set the |
Please doublecheck if the opensensus-shim lib is aligned with OTel 1.28.0... The error lines don't precisely match the current code. This forces the static init of the OTel SDK before we bootstrap the Quarkus SDK... This seems the same problem we had to solve with the JDBC drivers instrumentation. |
The opencensus shim is at 1.28.0-alpha (via the Quarkus platform bom). |
(Just thinking loud:)
Maybe it's feasible to copy the code to get the default project ID but use another HTTP client, because that seems to be the thing that implicitly creates the "offending" global tracer. I don't see an option to tell the Google HTTP client to omit tracing for a particular request. |
An ugly workaround could be to call I'm not sure whether it could work to always return a single |
Setting the System Property I mentioned above should avoid the need for this |
@geoand if I understand it correctly, we need to set |
But I have not tested it, I just think it will help just by looking at the code |
As described in [this issue](quarkusio/quarkus#35500), Quarkus w/ the Google clooud services and OpenCensus shim does not startup due to a static initialization issue. `com.google.cloud.ServiceOptions` is used by the extension to get the Google cloud default-project-ID, which uses Google's HTTP client, which uses OpenCensus, which triggers an initialization of OpenTelemetry, which conflicts with the OTel init from Quarkus. This change updates `GcpDefaultsConfigSourceFactory` to use Java's HTTP client. See also quarkiverse#487, the alternatives mentioned in [this comment](quarkiverse#487 (comment)) to implement a `ConfigSource` and in [this comment](quarkiverse#487 (comment)) to set `otel.java.global-autoconfigure.enabled=false)` end in the same OpenCensus/OpenTracing init race. Fixes quarkusio/quarkus#35500
As described in [this issue](quarkusio/quarkus#35500), Quarkus w/ the Google clooud services and OpenCensus shim does not startup due to a static initialization issue. `com.google.cloud.ServiceOptions` is used by the extension to get the Google cloud default-project-ID, which uses Google's HTTP client, which uses OpenCensus, which triggers an initialization of OpenTelemetry, which conflicts with the OTel init from Quarkus. This change updates `GcpDefaultsConfigSourceFactory` to use Java's HTTP client. See also quarkiverse#487, the alternatives mentioned in [this comment](quarkiverse#487 (comment)) to implement a `ConfigSource` and in [this comment](quarkiverse#487 (comment)) to set `otel.java.global-autoconfigure.enabled=false)` end in the same OpenCensus/OpenTracing init race. Fixes quarkusio/quarkus#35500
As described in [this issue](quarkusio/quarkus#35500), Quarkus w/ the Google clooud services and OpenCensus shim does not startup due to a static initialization issue. `com.google.cloud.ServiceOptions` is used by the extension to get the Google cloud default-project-ID, which uses Google's HTTP client, which uses OpenCensus, which triggers an initialization of OpenTelemetry, which conflicts with the OTel init from Quarkus. This change updates `GcpDefaultsConfigSourceFactory` to use Java's HTTP client. See also quarkiverse#487, the alternatives mentioned in [this comment](quarkiverse#487 (comment)) to implement a `ConfigSource` and in [this comment](quarkiverse#487 (comment)) to set `otel.java.global-autoconfigure.enabled=false)` end in the same OpenCensus/OpenTracing init race. Fixes quarkusio/quarkus#35500
As described in [this issue](quarkusio/quarkus#35500), Quarkus w/ the Google clooud services and OpenCensus shim does not startup due to a static initialization issue. `com.google.cloud.ServiceOptions` is used by the extension to get the Google cloud default-project-ID, which uses Google's HTTP client, which uses OpenCensus, which triggers an initialization of OpenTelemetry, which conflicts with the OTel init from Quarkus. This change updates `GcpDefaultsConfigSourceFactory` to use Java's HTTP client. See also quarkiverse#487, the alternatives mentioned in [this comment](quarkiverse#487 (comment)) to implement a `ConfigSource` and in [this comment](quarkiverse#487 (comment)) to set `otel.java.global-autoconfigure.enabled=false)` end in the same OpenCensus/OpenTracing init race. Fixes quarkusio/quarkus#35500
As described in [this issue](quarkusio/quarkus#35500), Quarkus w/ the Google clooud services and OpenCensus shim does not startup due to a static initialization issue. `com.google.cloud.ServiceOptions` is used by the extension to get the Google cloud default-project-ID, which uses Google's HTTP client, which uses OpenCensus, which triggers an initialization of OpenTelemetry, which conflicts with the OTel init from Quarkus. This change updates `GcpDefaultsConfigSourceFactory` to use Java's HTTP client. See also quarkiverse#487, the alternatives mentioned in [this comment](quarkiverse#487 (comment)) to implement a `ConfigSource` and in [this comment](quarkiverse#487 (comment)) to set `otel.java.global-autoconfigure.enabled=false)` end in the same OpenCensus/OpenTracing init race. Fixes quarkusio/quarkus#35500
This is needed because GcpDefaultsConfigSourceFactory is called very early in the application startup
and can thus mess up the OpenTelemetry configuration performed later by Quarkus
Fixes: quarkusio/quarkus#35500
P.S. This pattern is also used in Quarkus code here.