com.liguanqiao.grow.log.sleuth.utils.SleuthTracerUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grow-log-sleuth Show documentation
Show all versions of grow-log-sleuth Show documentation
Grow 分布式链路Spring Cloud Sleuth封装
The newest version!
package com.liguanqiao.grow.log.sleuth.utils;
import brave.Span;
import brave.Tracer;
import brave.propagation.TraceContext;
import lombok.experimental.UtilityClass;
import java.util.Optional;
/**
* @author liguanqiao
* @since 2023/1/12
**/
@UtilityClass
public class SleuthTracerUtil {
public static TraceContext join(Tracer tracer){
TraceContext traceContext = Optional.ofNullable(tracer.currentSpan())
.map(Span::context)
.orElseGet(tracer.newTrace()::context);
tracer.newChild(traceContext);
return traceContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy