-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 context disappears on ManagedExecutor thread #43134
Comments
/cc @brunobat (opentelemetry), @radcortez (opentelemetry) |
What do you see in the tracing side? Have you tried to create a new span for the new thread? |
From tracing side it looks okay. Enabling the logging exporter for the reproducer project:
I didn't try to create a new span for the new thread. After adding a @WithSpan in the worker thread, the MDC.traceID does always get correctly logged it seems:
|
Also cc @manovotn |
This might be another consequence of the way we handle scopes... |
Describe the bug
Given
Simplified code sample:
As per my investigation, the "main" thread is calling
OpenTelemetryUtil#clearMDCData(io.vertx.core.Context vertxContext)
, causing the MDC data to be cleared for the "worker" thread as well.Expected behavior
The tracing specific MDC context is available for log statements of the background work/thread.
Actual behavior
The tracing specific MDC context is not available for log statements.
Sample logging (assuming
quarkus.log.console.format
is configured to include MDC.traceId)How to Reproduce?
Reproducer: https://github.com/kerkhofsd/quarkus-issue-otel-clears-mdc
Output of
uname -a
orver
WSL Ubuntu 24.04.1 LTS
Output of
java -version
openjdk version "21.0.4" 2024-07-16
Quarkus version or git rev
3.14.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Additional information
No response
The text was updated successfully, but these errors were encountered: