admin管理员组文章数量:1334339
I am trying to integrate my service with opentelmentry to trace the service flow . Tracing tool : Yaeger
Note : I cannot go with javaagent becuase yaeger-exporter is not supoprted in latest version of javaagent . ()
My requirement is to maintain the same trace throughout even if the worker / executor threads are triggered in between , but currently this is not happening .
Code Block :
String traceId = getCurrentTraceId();
logger.info("Pran Traceid in Service "+ traceId);
executor.submit(runnableTask);
output :
2024-11-19 10:01:43,851 | INFO |[74230bef15e61516c4165702fcf04cee]|[c021715ac9e96148]| 33, **http-nio-8080-exec-1** | | Service | | | | | Pran Traceid in Service 74230bef15e61516c4165702fcf04cee
2024-11-18 14:51:22,465 | INFO |[]|[]| 53, **pool-4-thread-1** | | Application | | | | | run method triggered from Executors
I tried adding MDC to maintain the context but that didnot work with opentelmentry as MDC.get("traceId") is always coming as null
**
String traceId = MDC.get("traceId");
MDC.put("traceId", traceId);
try {
// Set the MDC context in the worker thread
MDC.put("traceId", traceId);
task.run();
} finally {
// Clean up the MDC context after execution
MDC.clear();
}
**
本文标签: tracetraceid is not passed to worker threads using opentelmnetry with jaegerStack Overflow
版权声明:本文标题:trace - trace_id is not passed to worker threads using opentelmnetry with jaeger - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742369586a2461967.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论