johnpoth commented on PR #15496:
URL: https://github.com/apache/camel/pull/15496#issuecomment-2355138476

   Hi @davsclaus thanks for your insights ! After some testing I don't think 
this is enough... Ideally OpenTelemetry wants a hook when a _thread_ starts 
some work and another hook when the work is done ( everything in the same 
thread):
   
   
   ```
        Context context = exchange.getProperty(ExchangePropertyKey.ACTIVE_SPAN, 
io.opentelemetry.context.Context.Context.class);
         Scope scope = context.makeCurrent();
   <!---- Thread starts work ---->
      
        
   <!---- Thread ends work ---->
        scope.close();
   ```
   
   Naively using the before/after process hooks in the UnitOfWorkAPI I get some 
errors like :
   
   ```
   Thread [Camel (camel-6) thread #36 - seda://c] opened scope, but thread 
[Camel (camel-6) thread #44 - Delay] closed it
   
   closed here: at 
org.apache.camel.opentelemetry.OpenTelemetryUnitOfWork.afterProcess(OpenTelemetryUnitOfWork.java:98)
 ~[classes/:?]
   
   opened here: at 
org.apache.camel.opentelemetry.OpenTelemetryUnitOfWork.beforeProcess(OpenTelemetryUnitOfWork.java:86)
 ~[classes/:?]
   ```
   
   
   For MDC to achieve this when in Multicast with parallel processing, it seems 
some more code was added in camel-core [1]
   
   [1] https://issues.apache.org/jira/browse/CAMEL-16378


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to