提交 7aefb8f8 编写于 作者: A ascrutae

修复部分问题

上级 27a2d53a
......@@ -77,12 +77,12 @@ public class Span {
this.parentLevel = "";
}
public Span(TraceId traceId, String parentLevel, int levelId, String applicationCode, String username) {
public Span(TraceId traceId, String parentLevel, int levelId, String applicationCode, String username, String viewPointId) {
this.traceId = traceId;
this.parentLevel = parentLevel;
this.levelId = levelId;
this.applicationId = applicationId;
this.userId = userId;
this.applicationCode = applicationCode;
this.username = username;
this.viewPointId = viewPointId;
this.routeKey = RoutingKeyGenerator.generate(viewPointId);
}
......
......@@ -29,7 +29,7 @@ public final class ContextGenerator {
Span spanData = CurrentThreadSpanStack.peek();
if (context != null && context.getTraceId() != null && spanData == null) {
spanData = new Span(context.getTraceId(), context.getParentLevel(), context.getLevelId(),
Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USER_ID, id.getViewPoint());
Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USERNAME, id.getViewPoint());
} else {
spanData = getSpanFromThreadLocal(id);
}
......@@ -45,14 +45,14 @@ public final class ContextGenerator {
int routeKey;
if (parentSpan == null) {
// 不存在,新创建一个Context
span = new Span(TraceIdGenerator.generate(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USER_ID);
span = new Span(TraceIdGenerator.generate(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USERNAME);
routeKey = RoutingKeyGenerator.generate(id.getViewPoint());
} else {
// 根据ParentContextData的TraceId和RPCID
// LevelId是由SpanNode类的nextSubSpanLevelId字段进行初始化的.
// 所以在这里不需要初始化
span = new Span(parentSpan.getTraceId(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USER_ID);
span = new Span(parentSpan.getTraceId(), Config.SkyWalking.APPLICATION_CODE, Config.SkyWalking.USERNAME);
if (!StringUtil.isEmpty(parentSpan.getParentLevel())) {
span.setParentLevel(parentSpan.getParentLevel() + "." + parentSpan.getLevelId());
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册