-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 MDC integration not quite working #26258
Comments
/cc @radcortez |
It is actually that the |
Since |
With 2.10.0.Final... if you run in native mode, or fat jar... it works though... just fast jar isn't working now... |
@luneo7 Thanks for the analysis. In the issue I mentioned dev-mode only, but I can confirm that it also doesn't work in the normal launch mode with the default packaging (which I think is fast-jar as you mention). |
I'll have a look |
This is a little complicated. As you have seen, implementations of The solution here would be for us to enable adding Service Loader files to the root path of the fast-jar. That way the service will be discoverable by the System ClassLoader. I can put something together next week (hopefully). |
Describe the bug
While Quarkus appears to register the trace context fine in the MDC using
VertxMDC
, it appears that it cannot be accessed using theorg.jboss.logging.MDC
class. AFAICT the issue appears to be that the static initialization oforg.jboss.logmanager.MDC#mdcProvider
may not be able to find theio.quarkus.bootstrap.logging.LateBoundMDCProvider
as registered in a correspondingMETA-INF/services
file. This appears to be due to the fact that the mentioned field gets initialized too early and not explicitly using the TCCL. At least when I start my application in dev-mode and set a breakpoint inorg.jboss.logmanager.MDC#getMDCProvider()
the class initialization is triggered by the initialization ofio.quarkus.deployment.dev.DevModeMain#log
.In my "ultimate" use case I simply want to use the
quarkus-logging-json
extension to log the log records (including MDC) in JSON and that should include the MDC. But when the logger attempts to get the MDC usingorg.jboss.logmanager.ExtLogRecord#getMdcCopy()
(which callsorg.jboss.logmanager.MDC.copyObject()
) the returned result is always empty, since it ends up using the defaultorg.jboss.logmanager.ThreadLocalMDC
rather than theio.quarkus.bootstrap.logging.LateBoundMDCProvider
implementation.Expected behavior
The MDC data supplied by the OpenTelemetry integration should be available via the
org.jboss.logging.MDC
API.Actual behavior
When using the
org.jboss.logging.MDC
API and also thequarkus-logging-json
extension the MDC data supplied by the Quarkus OpenTelemetry integration is not available.How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.10.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: