2023-10-31, [[[traceId=6540ee3f2997f144f45483631005208e, spanId=f45483631005208e]]] [http-nio- 8085-exec-1] ИНФОРМАЦИЯ com.example.trace.Controller – Привет изнутри
Я использую микрометрическую трассировку v1.1.6 с Brave v5.15.1 в качестве поставщика. Ниже приведены мои свойства application.properties
Код: Выделить всё
server.port=8085
spring.application.name=exampleApp
logging.pattern.console=%d{yyyy-MM-dd }, [[[%mdc]]] [%thread] %-5level %logger{36} - %msg%n
management.tracing.sampling.probability=0.0
management.tracing.propagation.type=B3_MULTI
logging.level.root=info
Код: Выделить всё
static String toTraceIdString(long traceIdHigh, long traceId) {
if (traceIdHigh != 0) {
char[] result = RecyclableBuffers.parseBuffer();
writeHexLong(result, 0, traceIdHigh);
writeHexLong(result, 16, traceId);
return new String(result, 0, 32);
}
return toLowerHex(traceId);
}
Как мне добавить 16-значный идентификатор трассировки в MDC вместо 32 символ TraceId+spanId как TraceId?
Подробнее здесь: https://stackoverflow.com/questions/773 ... long-inste
Мобильная версия