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

fix span code issue by codebeat.co.

上级 aa458f33
...@@ -62,15 +62,9 @@ public class Span { ...@@ -62,15 +62,9 @@ public class Span {
* 业务字段<br/> * 业务字段<br/>
*/ */
private String businessKey = ""; private String businessKey = "";
/**
* 应用编码
*/
private String applicationCode;
/**
* 归属用户
*/
private String username;
private String viewPointId; private String viewPointId;
private int routeKey; private int routeKey;
public Span(String operationName) { public Span(String operationName) {
...@@ -89,10 +83,9 @@ public class Span { ...@@ -89,10 +83,9 @@ public class Span {
this.traceId = traceId; this.traceId = traceId;
this.parentLevel = parentLevel; this.parentLevel = parentLevel;
this.levelId = levelId; this.levelId = levelId;
this.applicationCode = Config.SkyWalking.APPLICATION_CODE;
this.username = Config.SkyWalking.USERNAME;
this.routeKey = routeKey; this.routeKey = routeKey;
this.viewPointId = operationName; this.viewPointId = operationName;
this.startDate = System.currentTimeMillis();
} }
public TraceId getTraceId() { public TraceId getTraceId() {
...@@ -115,26 +108,6 @@ public class Span { ...@@ -115,26 +108,6 @@ public class Span {
this.levelId = levelId; this.levelId = levelId;
} }
public long getStartDate() {
return startDate;
}
public void setStartDate(long startDate) {
this.startDate = startDate;
}
public byte getStatusCode() {
return statusCode;
}
public String getExceptionStack() {
return exceptionStack;
}
public void setExceptionStack(String exceptionStack) {
this.exceptionStack = exceptionStack;
}
public void setSpanType(int spanType) { public void setSpanType(int spanType) {
this.spanType = spanType; this.spanType = spanType;
} }
...@@ -183,48 +156,20 @@ public class Span { ...@@ -183,48 +156,20 @@ public class Span {
this.businessKey = businessKey; this.businessKey = businessKey;
} }
public String getApplicationCode() {
return applicationCode;
}
public void setApplicationCode(String applicationCode) {
this.applicationCode = applicationCode;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void setViewPointId(String viewPointId) {
this.viewPointId = viewPointId;
}
public String getViewPointId() {
return viewPointId;
}
public RequestSpan.Builder buildRequestSpan(RequestSpan.Builder builder) { public RequestSpan.Builder buildRequestSpan(RequestSpan.Builder builder) {
builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId).setSpanType(this.spanType).setApplicationCode(this.applicationCode) builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId).setSpanType(this.spanType).setApplicationCode(Config.SkyWalking.APPLICATION_CODE)
.setUsername(this.username).setRouteKey(routeKey); .setUsername(Config.SkyWalking.USERNAME).setRouteKey(routeKey);
return builder; return builder;
} }
public AckSpan.Builder buildAckSpan(AckSpan.Builder builder) { public AckSpan.Builder buildAckSpan(AckSpan.Builder builder) {
builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId) builder.setTraceId(this.traceId).setParentLevel(this.parentLevel).setLevelId(this.levelId)
.setCost(System.currentTimeMillis() - this.startDate).setStatusCode(this.statusCode) .setCost(System.currentTimeMillis() - this.startDate).setStatusCode(this.statusCode)
.setExceptionStack(this.exceptionStack).setUsername(this.username).setApplicationCode(this.applicationCode) .setExceptionStack(this.exceptionStack).setUsername(Config.SkyWalking.USERNAME).setApplicationCode(Config.SkyWalking.APPLICATION_CODE)
.setViewpointId(this.viewPointId).setRouteKey(routeKey); .setViewpointId(this.viewPointId).setRouteKey(routeKey);
return builder; return builder;
} }
public void setRouteKey(int routeKey) {
this.routeKey = routeKey;
}
public int getRouteKey() { public int getRouteKey() {
return routeKey; return routeKey;
} }
......
...@@ -50,8 +50,6 @@ public final class ContextGenerator { ...@@ -50,8 +50,6 @@ public final class ContextGenerator {
span = new Span(parentSpan, id.getViewPoint()); span = new Span(parentSpan, id.getViewPoint());
} }
span.setStartDate(System.currentTimeMillis());
return span; return span;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册