-
Notifications
You must be signed in to change notification settings - Fork 2.8k
OpenTelemetry: context of sender not active in consumer #38061
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
Comments
/cc @brunobat (opentelemetry), @radcortez (opentelemetry) |
I'm also facing this issue (the other way around,: an HTTP Request that uses However, I'm not sure if it's a bug or an enhancement request. The docs (here and/or here) says that only |
I stumbled upon the same problem. My way to work around it is to pass @ConsumeEvent("TEST-EVENT")
public String testEvent(MyEventObj event) {
try (var _ = event.getOtelContext().makeCurrent()) {
// do work
}
} Would love to have this implicitly done by the EventBus itself. |
I faced the same when blocking = true or virtualThread= true. |
Hi, quick question. Was this implementation reverted? I just updated to Quarkus 3.20 (from 3.15) but the traceId is still not visible in the logs (mdc empty). Code is similar to this: @Path("/dummyroot")
public class DummyResource {
private final EventBus eventBus;
@Inject
public DummyResource (EventBus eventBus) {
this.eventBus = eventBus;
}
@POST
@Path("/dummy")
public Response process(DTO request) {
// some code
Log.info("this log has traceId");
eventBus.send("blocking-dummy-consumer", request);
// some code
}
@ConsumeEvent(value = "blocking-dummy-consumer", blocking = true)
void consumeBlockingDummyEvent(DTO request) {
try {
// some code, including calling method from another injected object
} catch (Exception e) {
Log.error("this log doesn't have traceId", e);
}
}
} |
@gian1200 are you formating the output log? Trace Ids will not show up by default. |
On local, yes. We actually do:
Example log: 2025-03-28 08:14:45,396 INFO {sampled=true, spanId=d6e3c8ec40413ab7, traceId=843553e6fabb522b1f09b58033da48d0} [com.xxx.xxx.res.DummyResource] (executor-thread-1) Some random Log with traceId
2025-03-28 08:14:46,130 INFO {} [com.xxx.xxx.ser.DummyService] (vert.x-worker-thread-1) Starting here there is no mdc info
2025-03-28 08:14:46,132 INFO {} [comxxx.xxx.ser.ObjectStorageService] (vert.x-worker-thread-1) Log with no mdc info
2025-03-28 08:14:48,193 ERROR {} [com.xxx.xxx.res.DummyResource] (vert.x-worker-thread-1) Error log with no mdc info On cloud we use |
@gian1200 tracing info needs to be retreived from the MDC context like this: |
@brunobat, thanks for answering.
|
Please file an a bug with a reproducer. This issue is closed. |
done #47063 |
I'm pretty sure the reproducer for this issue still reproduces the issue. Meaning that the issue I reported may not really have been fixed. I will try to check my reproducer again. |
Describe the bug
When a
@ConsumeEvent
method is executed the OpenTelementry context of the sender is not active.The result of this is that logging MDC, and further calls do not get a tracing context.
Annotating the method with
@WithSpan
does activate a context, but it is not based on the existing context.Stepping though the code I can see that the underlying Vert.x Message does have the existing context stored in the
trace
field.Expected behavior
The Opentelemetry context of message sender is active, a new span is created when
@WithSpan
is used.Actual behavior
@WithSpan
activates a context, but it is not based on the context of the sender.Without
@WithSpan
no context is active, and rest client calls does not get a traceid.How to Reproduce?
A reproducer: https://github.com/computerlove/quarkus-trace-mdc-eventbus
It creates a Thread that first set up a OpenTracing Context, sends a event bus message, which sends a rest request.
Output of
uname -a
orver
na
Output of
java -version
21
Quarkus version or git rev
3.6.4
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: