Spring Boot - get Trace and Span ID programmatically
这篇文章介绍了在Spring Boot中如何通过编程方式获取Trace ID和Span ID。通过自动装配Tracer并使用currentSpan()方法获取当前Span对象,可以轻松获得traceId和spanId以用于跟踪和调试。 2025-2-27 17:8:0 Author: blog.gtiwari333.com(查看原文) 阅读量:10 收藏

Spring Boot - get Trace and Span ID programmatically

 Autowire Tracer tracer

and get traceId and spanId from current Span


Span
span = tracer.currentSpan();
span.context().traceId() //trace ID span.context().spanId() //span ID

No comments :

Post a Comment

Your Comment and Question will help to make this blog better...


文章来源: http://blog.gtiwari333.com/2025/02/spring-boot-get-trace-and-span-id.html
如有侵权请联系:admin#unsafe.sh