mcrmfc commented on pull request #3984: URL: https://github.com/apache/camel/pull/3984#issuecomment-658270788
> Ah nice! I was planning to give this a shot as well :) It's good to know there are others interested in this > > The problem I figured with simply activating the Spans is that the default ScopeManager is a ThreadLocalScopeManager which will infinitely keep growing references to the Scoped spans. The Scopes need to be consequently closed. I don't know if the thread local manager is the best fit for camel though. > > One alternative is to create processor interceptors that will activate and close scopes before and after every processor, this will allow us to do `GlobalTracer.get().activeSpan()` which would also allow other OpenTracing instrumentation to work and link to the camel created Spans. This is how instrumentation for Mule 4 works. > Ah nice! I was planning to give this a shot as well :) It's good to know there are others interested in this > > The problem I figured with simply activating the Spans is that the default ScopeManager is a ThreadLocalScopeManager which will infinitely keep growing references to the Scoped spans. The Scopes need to be consequently closed. I don't know if the thread local manager is the best fit for camel though. > > One alternative is to create processor interceptors that will activate and close scopes before and after every processor, this will allow us to do `GlobalTracer.get().activeSpan()` which would also allow other OpenTracing instrumentation to work and link to the camel created Spans. This is how instrumentation for Mule 4 works. @jam01 - what are your thoughts as to passing the `scope` returned from `activate` to the `ActiveSpanManager.activate()` method, then we could store in the existing `Holder` and close in the `ActiveSpanManager.deactivate()` method this way we are just ensuring the global tracer is in sync with the internal span activation state? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org