I am using spring-cloud-starter-sleuth 2.0.0 M6
and due to breaking changes I cannot use my previous configuration which allows me to see the (human readable) span names in console logs instead of spanId
s.
I want to see [app,98ec5c2ab34ea626,span-name,false]
instead of [app,98ec5c2ab34ea626,f56b4623ee2e9a3f,false]
I used to configure it in 2.0.0M1
as follows:
class CustomSlf4jSpanLogger implements SpanLogger {
@Override
public void logStartedSpan(Span parent, Span span) {
MDC.put(Span.SPAN_ID_NAME, span.getName());
MDC.put(Span.SPAN_NAME_NAME, span.getName());
MDC.put(Span.SPAN_EXPORT_NAME, String.valueOf(span.isExportable()));
MDC.put(Span.TRACE_ID_NAME, span.traceIdString());
log("Starting span: {}", span);
if (parent != null) {
log("With parent: {}", parent);
MDC.put(Span.PARENT_ID_NAME, Span.idToHex(parent.getSpanId()));
}
}
// the rest is omitted for brevity
}
Now SpanLogger
is gone. Closest thing I could find is Slf4jCurrentTraceContext however currentSpan
which is of type TraceContext
has no span name in it.
How can I configure this in 2.0.0 M6
?