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

OpenTelemetry JDBC instrumentation shouldn't initialize OpenTelemetry at build time #8080

Closed
michalvavrik opened this issue Mar 18, 2023 · 1 comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request

Comments

@michalvavrik
Copy link
Contributor

michalvavrik commented Mar 18, 2023

Is your feature request related to a problem? Please describe.

Quarkus is using OpenTelemetryDatasource in the Quarkus Agroal extension, which allows users to trace JDBC queries. As we create OpenTelemetry at runtime (in order to support OpenTelemetry SDK Autoconfigure), we can't have classes statically accessing OpenTelemetry via GlobalOpenTelemetry#get at build time, however that's exactly what JdbcSingletons does:

As JdbcSingletons is only used by OpenTelemetryDriver we have to remove both in order to adapt opentelemetry-jdbc for native mode. This shouldn't be necessary as we shouldn't need knowledge of jdbc.internal package, for it is an API that is unstable and can change at any time.

Describe the solution you'd like

As the driver is singleton and initialized statically, we need lazy io.opentelemetry.instrumentation.jdbc.internal.JdbcSingletons#STATEMENT_INSTRUMENTER to be lazily initialized. Either we can use volatile or synchronized for the initialization needs to be thread safe.

Describe alternatives you've considered

I don't see other options.

Additional context

I'm happy to take care of this when I find a little time, the problem is not time sensitive.

@michalvavrik michalvavrik added the enhancement New feature or request label Mar 18, 2023
@trask trask added the contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome label Aug 10, 2023
@trask
Copy link
Member

trask commented Dec 23, 2024

Resolved by #9625 (also see #12963)

@trask trask closed this as completed Dec 23, 2024
zakkak added a commit to zakkak/quarkus that referenced this issue Jan 13, 2025
zakkak added a commit to zakkak/quarkus that referenced this issue Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants