重构span的相关数据结构,准备发送协议的大规模调整
This commit is contained in:
parent
34fd22c794
commit
60910b47d9
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.analysis.chainbuild;
|
||||
|
||||
import com.ai.cloud.skywalking.analysis.chainbuild.po.ChainNode;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.Span;
|
||||
|
||||
public class SpanEntry {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.ai.cloud.skywalking.api;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public interface IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import com.ai.cloud.skywalking.model.ContextData;
|
|||
import com.ai.cloud.skywalking.model.EmptyContextData;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.protocol.Span;
|
||||
import com.ai.cloud.skywalking.protocol.SpanType;
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
import com.ai.cloud.skywalking.util.ContextGenerator;
|
||||
|
||||
public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.ai.cloud.skywalking.logging.Logger;
|
|||
import com.ai.cloud.skywalking.model.ContextData;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.protocol.Span;
|
||||
import com.ai.cloud.skywalking.protocol.SpanType;
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
import com.ai.cloud.skywalking.util.ContextGenerator;
|
||||
|
||||
public class RPCServerInvokeMonitor extends BaseInvokeMonitor {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.ai.cloud.skywalking.context.CurrentThreadSpanStack;
|
|||
import com.ai.cloud.skywalking.model.ContextData;
|
||||
import com.ai.cloud.skywalking.model.Identification;
|
||||
import com.ai.cloud.skywalking.protocol.Span;
|
||||
import com.ai.cloud.skywalking.protocol.SpanType;
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
|
||||
public final class ContextGenerator {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
*/
|
||||
public class AckSpan extends AbstractDataSerializable {
|
||||
/**
|
||||
* tid,调用链的全局唯一标识
|
||||
*/
|
||||
protected String traceId;
|
||||
/**
|
||||
* 当前调用链的上级描述<br/>
|
||||
* 如当前序号为:0.1.0时,parentLevel=0.1
|
||||
*/
|
||||
protected String parentLevel;
|
||||
/**
|
||||
* 当前调用链的本机描述<br/>
|
||||
* 如当前序号为:0.1.0时,levelId=0
|
||||
*/
|
||||
protected int levelId = 0;
|
||||
/**
|
||||
* 节点调用花费时间
|
||||
*/
|
||||
protected long cost = 0L;
|
||||
/**
|
||||
* 节点调用的状态<br/>
|
||||
* 0:成功<br/>
|
||||
* 1:异常<br/>
|
||||
* 异常判断原则:代码产生exception,并且此exception不在忽略列表中
|
||||
*/
|
||||
protected byte statusCode = 0;
|
||||
/**
|
||||
* 节点调用的错误堆栈<br/>
|
||||
* 堆栈以JAVA的exception为主要判断依据
|
||||
*/
|
||||
protected String exceptionStack;
|
||||
|
||||
public String getTraceId() {
|
||||
return traceId;
|
||||
}
|
||||
|
||||
public void setTraceId(String traceId) {
|
||||
this.traceId = traceId;
|
||||
}
|
||||
|
||||
public String getParentLevel() {
|
||||
return parentLevel;
|
||||
}
|
||||
|
||||
public void setParentLevel(String parentLevel) {
|
||||
this.parentLevel = parentLevel;
|
||||
}
|
||||
|
||||
public int getLevelId() {
|
||||
return levelId;
|
||||
}
|
||||
|
||||
public void setLevelId(int levelId) {
|
||||
this.levelId = levelId;
|
||||
}
|
||||
|
||||
public long getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void setCost(long cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public byte getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(byte statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public String getExceptionStack() {
|
||||
return exceptionStack;
|
||||
}
|
||||
|
||||
public void setExceptionStack(String exceptionStack) {
|
||||
this.exceptionStack = exceptionStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getData() {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.common.NullableClass;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,185 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
*/
|
||||
public class RequestSpan extends AbstractDataSerializable {
|
||||
/**
|
||||
* tid,调用链的全局唯一标识
|
||||
*/
|
||||
protected String traceId;
|
||||
/**
|
||||
* 当前调用链的上级描述<br/>
|
||||
* 如当前序号为:0.1.0时,parentLevel=0.1
|
||||
*/
|
||||
protected String parentLevel;
|
||||
/**
|
||||
* 当前调用链的本机描述<br/>
|
||||
* 如当前序号为:0.1.0时,levelId=0
|
||||
*/
|
||||
protected int levelId = 0;
|
||||
/**
|
||||
* 调用链中单个节点的入口描述<br/>
|
||||
* 如:java方法名,调用的RPC地址等等
|
||||
*/
|
||||
protected String viewPointId = "";
|
||||
/**
|
||||
* 节点调用开始时间
|
||||
*/
|
||||
protected long startDate = System.currentTimeMillis();
|
||||
/**
|
||||
* 节点调用的发生机器描述<br/>
|
||||
* 包含机器名 + IP地址
|
||||
*/
|
||||
protected String address = "";
|
||||
|
||||
/**
|
||||
* 节点类型描述<br/>
|
||||
* 已字符串的形式描述<br/>
|
||||
* 如:java,dubbo等
|
||||
*/
|
||||
protected String spanTypeDesc = "";
|
||||
|
||||
/**
|
||||
* 节点调用类型描述<br/>
|
||||
* @see CallType
|
||||
*/
|
||||
protected String callType = "";
|
||||
|
||||
/**
|
||||
* 节点分布式类型<br/>
|
||||
* 本地调用 / RPC服务端 / RPC客户端
|
||||
*/
|
||||
protected SpanType spanType = SpanType.LOCAL;
|
||||
|
||||
/**
|
||||
* 节点调用的所在进程号
|
||||
*/
|
||||
protected String processNo = "";
|
||||
/**
|
||||
* 节点调用所在的系统逻辑名称<br/>
|
||||
* 由授权文件指定
|
||||
*/
|
||||
protected String applicationId = "";
|
||||
|
||||
/**
|
||||
* 用户id<br/>
|
||||
* 由授权文件指定
|
||||
*/
|
||||
protected String userId;
|
||||
|
||||
public String getTraceId() {
|
||||
return traceId;
|
||||
}
|
||||
|
||||
public void setTraceId(String traceId) {
|
||||
this.traceId = traceId;
|
||||
}
|
||||
|
||||
public String getParentLevel() {
|
||||
return parentLevel;
|
||||
}
|
||||
|
||||
public void setParentLevel(String parentLevel) {
|
||||
this.parentLevel = parentLevel;
|
||||
}
|
||||
|
||||
public int getLevelId() {
|
||||
return levelId;
|
||||
}
|
||||
|
||||
public void setLevelId(int levelId) {
|
||||
this.levelId = levelId;
|
||||
}
|
||||
|
||||
public String getViewPointId() {
|
||||
return viewPointId;
|
||||
}
|
||||
|
||||
public void setViewPointId(String viewPointId) {
|
||||
this.viewPointId = viewPointId;
|
||||
}
|
||||
|
||||
public long getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(long startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getSpanTypeDesc() {
|
||||
return spanTypeDesc;
|
||||
}
|
||||
|
||||
public void setSpanTypeDesc(String spanTypeDesc) {
|
||||
this.spanTypeDesc = spanTypeDesc;
|
||||
}
|
||||
|
||||
public String getCallType() {
|
||||
return callType;
|
||||
}
|
||||
|
||||
public void setCallType(String callType) {
|
||||
this.callType = callType;
|
||||
}
|
||||
|
||||
public SpanType getSpanType() {
|
||||
return spanType;
|
||||
}
|
||||
|
||||
public void setSpanType(SpanType spanType) {
|
||||
this.spanType = spanType;
|
||||
}
|
||||
|
||||
public String getProcessNo() {
|
||||
return processNo;
|
||||
}
|
||||
|
||||
public void setProcessNo(String processNo) {
|
||||
this.processNo = processNo;
|
||||
}
|
||||
|
||||
public String getApplicationId() {
|
||||
return applicationId;
|
||||
}
|
||||
|
||||
public void setApplicationId(String applicationId) {
|
||||
this.applicationId = applicationId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataType() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getData() {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.SpanType;
|
||||
|
||||
public abstract class SpanData {
|
||||
/**
|
||||
* Span在序列中,各字段间的分隔符
|
||||
|
|
@ -70,7 +73,7 @@ public abstract class SpanData {
|
|||
protected String spanTypeDesc = "";
|
||||
/**
|
||||
* 节点调用类型描述<br/>
|
||||
* @see com.ai.cloud.skywalking.protocol.CallType
|
||||
* @see CallType
|
||||
*/
|
||||
protected String callType = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
package com.ai.cloud.skywalking.protocol.common;
|
||||
|
||||
import com.ai.cloud.skywalking.protocol.NullClass;
|
||||
import com.ai.cloud.skywalking.protocol.SerializableDataTypeRegister;
|
||||
import com.ai.cloud.skywalking.util.IntegerAssist;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -8,7 +10,7 @@ import java.util.Set;
|
|||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
*/
|
||||
public abstract class AbstractDataSerializable implements ISerializable, NullableClass{
|
||||
public abstract class AbstractDataSerializable implements ISerializable, NullableClass {
|
||||
private static Set<Integer> DATA_TYPE_SCOPE = new HashSet<Integer>();
|
||||
|
||||
public AbstractDataSerializable(){
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
package com.ai.cloud.skywalking.protocol.common;
|
||||
|
||||
public enum CallType {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
package com.ai.cloud.skywalking.protocol.common;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
package com.ai.cloud.skywalking.protocol.common;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ai.cloud.skywalking.protocol;
|
||||
package com.ai.cloud.skywalking.protocol.common;
|
||||
|
||||
import com.ai.cloud.skywalking.exception.SpanTypeCannotConvertException;
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.plugin.dubbo;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class DubboBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.skywalking.httpClient.v4.plugin;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class WebBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.plugin.jdbc;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class JDBCBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.jedis.v2.plugin;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class RedisBuriedPointType implements IBuriedPointType {
|
||||
private static RedisBuriedPointType redisBuriedPointType;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.plugin.spring;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class SpringBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.ai.cloud.skywalking.plugin.web;
|
||||
|
||||
import com.ai.cloud.skywalking.api.IBuriedPointType;
|
||||
import com.ai.cloud.skywalking.protocol.CallType;
|
||||
import com.ai.cloud.skywalking.protocol.common.CallType;
|
||||
|
||||
public class WebBuriedPointType implements IBuriedPointType {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue