连接Java日志和跟踪TraceID和Span ID的值为零
我正在遵循DataDog文档中的连接Java日志和跟踪: “ noreferrer”> htttps:/ = slf4jandlogback
我在端点中添加了下一个代码:
import org.slf4j.MDC;
import datadog.trace.api.CorrelationIdentifier;
// There must be spans started and active before this block.
try {
MDC.put("dd.trace_id", CorrelationIdentifier.getTraceId());
MDC.put("dd.span_id", CorrelationIdentifier.getSpanId());
// Log something
} finally {
MDC.remove("dd.trace_id");
MDC.remove("dd.span_id");
}
在控制台中,我可以看到下一个日志:dd.trace_id':“ 0”,“ dd.span_id”:“ 0”}
我不确定为什么我没有得到正确的trace_id和span_id,为什么这些值是零的
?
I am following the Connecting Java logs and Traces from the Datadog docs:
https://docs.datadoghq.com/tracing/connect_logs_and_traces/java/?tab=slf4jandlogback
I added the next code to my endpoint:
import org.slf4j.MDC;
import datadog.trace.api.CorrelationIdentifier;
// There must be spans started and active before this block.
try {
MDC.put("dd.trace_id", CorrelationIdentifier.getTraceId());
MDC.put("dd.span_id", CorrelationIdentifier.getSpanId());
// Log something
} finally {
MDC.remove("dd.trace_id");
MDC.remove("dd.span_id");
}
In the console I can see the next logs: dd.trace_id":"0","dd.span_id":"0"}
I am not pretty sure why I am not getting a correct trace_id and span_id and why these values are Zero.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论