我有以下设置:
代理(P)--HTTP-->Spring Boot 2应用程序(X)--HTTP-->Spring Boot 1应用程序(Y)
requestId
作为我需要包含在X和Y的日志中的HTTP报头。
spring:
sleuth:
propagation-keys: requestId
CurrentTraceContext
实施灵感来自
Slf4jCurrentTraceContext
我加上
MDC.put("requestId", ExtraFieldPropagation.get(currentSpan, "requestId"));
%d{yy-MM-dd E HH:mm:ss.SSS} %5p [component=${springAppName},requestId=%X{requestId:-}] %m%n"
但现在我需要传播
请求ID
同样适用于Y应用程序。
不幸的是,我不能利用SpringCloudSleuth2.0中引入的好东西(比如BraveLibrary中的TraceContext),因为这是一个SpringBoot1.x应用程序。
想知道有什么选择吗?
我在考虑延长期限
Slf4jSpanLogger
DefaultTracer
但不知道如何得到
请求ID
SpanLogger中没有TraceContext。