|
|
@@ -17,7 +17,7 @@ public class TraceInfo {
|
|
|
private static volatile int counter = 0;
|
|
|
|
|
|
private String traceId;
|
|
|
- private String rpcId;
|
|
|
+ private String spanId;
|
|
|
|
|
|
// 在现有字段中添加时间戳记录
|
|
|
private static volatile long lastTimestamp = 0;
|
|
|
@@ -25,22 +25,22 @@ public class TraceInfo {
|
|
|
/**
|
|
|
* 根据当前RPC ID生成子级RPC ID
|
|
|
*/
|
|
|
- public static String generateChildRpcId(String currentRpcId) {
|
|
|
- if (StringUtils.isEmpty(currentRpcId)) {
|
|
|
- return "1";
|
|
|
+ public static String generateChildSpanId(String currentSpanId) {
|
|
|
+ if (StringUtils.isEmpty(currentSpanId)) {
|
|
|
+ return "0";
|
|
|
}
|
|
|
- return currentRpcId + ".1";
|
|
|
+ return currentSpanId + ".1";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据当前RPC ID生成同级下一个RPC ID
|
|
|
*/
|
|
|
- public static String generateNextRpcId(String currentRpcId) {
|
|
|
- return incurRpcId(currentRpcId);
|
|
|
+ public static String generateNextSpanId(String currentSpanId) {
|
|
|
+ return incurSpanId(currentSpanId);
|
|
|
}
|
|
|
|
|
|
- public void updateNextRpcId(){
|
|
|
- rpcId = incurRpcId(rpcId);
|
|
|
+ public void updateNextSpanId(){
|
|
|
+ spanId = incurSpanId(spanId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -90,7 +90,7 @@ public class TraceInfo {
|
|
|
return ++counter % 10000;
|
|
|
}
|
|
|
|
|
|
- private static String incurRpcId(String currentRpcId){
|
|
|
+ private static String incurSpanId(String currentRpcId){
|
|
|
if (StringUtils.isEmpty(currentRpcId)){
|
|
|
return "1";
|
|
|
}
|