-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix context propagation for guava AsyncEventBus #14791
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
Fix context propagation for guava AsyncEventBus #14791
Conversation
@xiangtianyu do you know whether this PR resolves #6273? |
I build a demo like this: public class MyNotifier {
private static final Logger log = LoggerFactory.getLogger(MyNotifier.class);
@Subscribe
public void handleEvent(String event) {
log.info("Received event: {}", event);
log.info("traceId: {}", Span.current().getSpanContext().getTraceId());
log.info("spanId: {}", Span.current().getSpanContext().getSpanId());
}
}
@RequestMapping("eventbus")
public String eventbus() {
log.info("Posting event to EventBus");
log.info("traceId: {}", Span.current().getSpanContext().getTraceId());
log.info("spanId: {}", Span.current().getSpanContext().getSpanId());
asyncEventBus.post("Hello, AsyncEventBus!");
return "eventbus";
} |
BTW, if i want to create bus event instrumentation, it should be a new independent instrumentation "guava-eventbus" or a part of guava instrumentation? |
I'd add it under the guava instrumentation. |
would it be possible to add a regression test for this? |
I don't know what to do. Add a test for eventbus in guava instrumentation? Or any other ways? |
🔧 The result from spotlessApply was committed to the PR branch. |
I tried to add a test for this case in guava instrumentation |
Thank you for your contribution @xiangtianyu! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
resolves to #6273
AsyncEventBus can cause trace IDs to appear as "0000000000000000". The issue is resolved by removing the event bus class from the OpenTelemetry agent's ignore list, as AsyncEventBus relies on an executor that the agent already supports.
https://github.com/google/guava/blob/d7240c0eedbef92ca40377e864a77a1e30e91474/guava/src/com/google/common/eventbus/Subscriber.java#L66-L75