-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Hi, I am trying to propagate the tracing context with the Micrometer Observation API while using the AWS SDK SqsAsyncClient, which operates on the Netty Event Loop Model.
Even though I have registered ObservationThreadLocalAccessor and ObservationAwareSpanThreadLocalAccessor with ContextRegistry, and instrumented executors (configuration details of SqsAsyncClient I described in this discussion):
executor.setTaskDecorator(new ContextPropagatingTaskDecorator());I am still unable to access the currently opened scope because the executors are invoked from the Netty EventLoop thread.
I am seeking any possible workaround until the issue is resolved.
The only solution I can think of involves using an implementation of ContextAccessor and a custom ObservationContextHolder:
executor.setTaskDecorator(runnable -> factory.captureAll(ObservationContextHolder.storedValues()).wrap(runnable));where ObservationContextHolder properly stores values for the keys ObservationThreadLocalAccessor.KEY and ObservationAwareSpanThreadLocalAccessor.KEY.
However, this solution is not thread-safe.
Could you please advise on a proper workaround or solution?