提交 786f89f2 编写于 作者: wu-sheng's avatar wu-sheng

Create a new method about getTraceSegmentId

上级 bbe79aa8
......@@ -53,6 +53,18 @@ public enum ContextManager implements TracerContextListener {
get().extract(carrier);
}
/**
* @return the {@link TraceSegment#traceSegmentId} if exist. Otherwise, "N/A".
*/
public String getTraceSegmentId(){
TracerContext segment = CONTEXT.get();
if(segment == null){
return "N/A";
}else{
return segment.getTraceSegmentId();
}
}
public Span createSpan(String operationName) {
return get().createSpan(operationName);
}
......
......@@ -88,6 +88,13 @@ public final class TracerContext {
stopSpan(span, System.currentTimeMillis());
}
/**
* @return the current trace segment id.
*/
String getTraceSegmentId(){
return segment.getTraceSegmentId();
}
public void stopSpan(Span span, Long endTime){
Span lastSpan = peek();
if (lastSpan == span) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册