Spring Cloud Sleuth 能否提供日志的跨度持续时间?
Can Spring Cloud Sleuth provide span duration for logs?
我正在使用 Spring Cloud Sleuth 为我的应用程序提供分布式跟踪。
使用 logback-spring.xml 通过 logback 记录跟踪。
此配置指定以下日志记录模式:
{
"severity": "%level",
"service": "${springAppName:-}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"parent": "%X{X-B3-ParentSpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"rest": "%message"
}
Sleuth 会自动计算跨度持续时间吗?是否可以将跨度持续时间添加到此日志记录模式?
Does Sleuth automatically calculates span duration
是的
and is it possible to add span duration to this logging pattern?
您必须覆盖当前的日志记录机制才能将跨度持续时间添加到 MDC
跨度持续时间的问题在于,一旦跨度停止/报告,它就会正确计算。但我真的不知道这对你来说是否有问题。
我正在使用 Spring Cloud Sleuth 为我的应用程序提供分布式跟踪。
使用 logback-spring.xml 通过 logback 记录跟踪。
此配置指定以下日志记录模式:
{
"severity": "%level",
"service": "${springAppName:-}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"parent": "%X{X-B3-ParentSpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"rest": "%message"
}
Sleuth 会自动计算跨度持续时间吗?是否可以将跨度持续时间添加到此日志记录模式?
Does Sleuth automatically calculates span duration
是的
and is it possible to add span duration to this logging pattern?
您必须覆盖当前的日志记录机制才能将跨度持续时间添加到 MDC
跨度持续时间的问题在于,一旦跨度停止/报告,它就会正确计算。但我真的不知道这对你来说是否有问题。