Span新增一个构造函数

This commit is contained in:
zhangxin10 2015-11-30 22:21:33 +08:00
parent ce5544228e
commit 9bfc3ce1a8
3 changed files with 18 additions and 13 deletions

View File

@ -34,9 +34,7 @@ public final class ContextGenerator {
spanData = new Span(TraceIdGenerator.generate(), Config.SkyWalking.APPLICATION_ID);
} else {
// 如果不为空则将当前的Context存放到上下文
spanData = new Span(context.getTraceId(), Config.SkyWalking.APPLICATION_ID);
spanData.setParentLevel(context.getParentLevel());
spanData.setLevelId(context.getLevelId());
spanData = new Span(context.getTraceId(), context.getParentLevel(), context.getLevelId(), Config.SkyWalking.APPLICATION_ID);
}
initNewSpanData(spanData, id);

View File

@ -18,6 +18,13 @@ public class Span extends SpanData {
this.applicationId = applicationID;
}
public Span(String traceId, String parentLevelId, int levelId, String applicationID) {
this.traceId = traceId;
this.applicationId = applicationID;
this.parentLevel = parentLevelId;
this.levelId = levelId;
}
public Span(String originData) {
String[] fieldValues = originData.split(SPILT_REGEX);
traceId = fieldValues[0].trim();

View File

@ -10,19 +10,19 @@ public abstract class SpanData {
protected String traceId;
protected String parentLevel;
protected int levelId;
protected String viewPointId;
protected long startDate;
protected long cost;
protected String address;
protected int levelId = 0;
protected String viewPointId = "";
protected long startDate = System.currentTimeMillis();
protected long cost = 0L;
protected String address = "";
protected byte statusCode = 0;
protected String exceptionStack;
protected char spanType;
protected char spanType = 'M';
protected boolean isReceiver = false;
protected String businessKey;
protected String processNo;
protected String applicationId;
protected String originData;
protected String businessKey = "";
protected String processNo = "";
protected String applicationId = "";
protected String originData = "";
public String getTraceId() {