diff --git a/.travis.yml b/.travis.yml
index dbb5bb01e..aa6e2eb01 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,6 +6,9 @@ install:
- mvn install:install-file -Dfile=dubbox-2.8.4.jar -DgroupId=com.alibaba -DartifactId=dubbox -Dversion=2.8.4 -Dpackaging=jar
- mvn install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar
- cd ..
-
+
script:
+ - cd skywalking-protocal
+ - mvn clean install -Dmaven.test.skip=true
+ - cd ..
- mvn clean install -Dmaven.test.skip=true
diff --git a/pom.xml b/pom.xml
index 461b38fc8..a71b3e297 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,11 @@
4.12
test
+
+ com.ai.cloud
+ skywalking-protocol
+ 1.0-Final
+
diff --git a/skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/util/HBaseUtil.java b/skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/util/HBaseUtil.java
index a63653216..2dd224932 100644
--- a/skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/util/HBaseUtil.java
+++ b/skywalking-analysis/src/main/java/com/ai/cloud/skywalking/analysis/chainbuild/util/HBaseUtil.java
@@ -9,6 +9,7 @@ import com.ai.cloud.skywalking.analysis.config.HBaseTableMetaData;
import com.ai.cloud.skywalking.protocol.AckSpan;
import com.ai.cloud.skywalking.protocol.FullSpan;
import com.ai.cloud.skywalking.protocol.RequestSpan;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.protobuf.InvalidProtocolBufferException;
@@ -75,7 +76,8 @@ public class HBaseUtil {
if (configuration == null) {
configuration = HBaseConfiguration.create();
if (Config.HBase.ZK_QUORUM == null || "".equals(Config.HBase.ZK_QUORUM)) {
- logger.error("Miss HBase ZK quorum Configuration", new IllegalArgumentException("Miss HBase ZK quorum Configuration"));
+ logger.error("Miss HBase ZK quorum Configuration",
+ new IllegalArgumentException("Miss HBase ZK quorum Configuration"));
System.exit(-1);
}
configuration.set("hbase.zookeeper.quorum", Config.HBase.ZK_QUORUM);
@@ -86,7 +88,8 @@ public class HBaseUtil {
public static ChainNodeSpecificMinSummary loadSpecificMinSummary(String key, String qualifier) throws IOException {
ChainNodeSpecificMinSummary result = null;
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.TABLE_NAME));
Get g = new Get(Bytes.toBytes(key));
Result r = table.get(g);
@@ -94,12 +97,13 @@ public class HBaseUtil {
return new ChainNodeSpecificMinSummary();
}
- Cell cell = r.getColumnLatestCell(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.COLUMN_FAMILY_NAME.getBytes(),
- qualifier.getBytes());
+ Cell cell =
+ r.getColumnLatestCell(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.COLUMN_FAMILY_NAME.getBytes(),
+ qualifier.getBytes());
if (cell != null && cell.getValueArray().length > 0) {
- result = new ChainNodeSpecificMinSummary(Bytes.toString(cell.getValueArray(),
- cell.getValueOffset(), cell.getValueLength()));
+ result = new ChainNodeSpecificMinSummary(
+ Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
} else {
result = new ChainNodeSpecificMinSummary();
}
@@ -107,9 +111,11 @@ public class HBaseUtil {
return result;
}
- public static ChainNodeSpecificHourSummary loadSpecificHourSummary(String keyOfHourSummaryTable, String treeNodeId) throws IOException {
+ public static ChainNodeSpecificHourSummary loadSpecificHourSummary(String keyOfHourSummaryTable, String treeNodeId)
+ throws IOException {
ChainNodeSpecificHourSummary result = null;
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_HOUR_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_HOUR_SUMMARY.TABLE_NAME));
Get g = new Get(Bytes.toBytes(keyOfHourSummaryTable));
Result r = table.get(g);
@@ -121,8 +127,8 @@ public class HBaseUtil {
treeNodeId.getBytes());
if (cell != null && cell.getValueArray().length > 0) {
- result = new ChainNodeSpecificHourSummary(Bytes.toString(cell.getValueArray(),
- cell.getValueOffset(), cell.getValueLength()));
+ result = new ChainNodeSpecificHourSummary(
+ Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
} else {
result = new ChainNodeSpecificHourSummary();
}
@@ -130,7 +136,8 @@ public class HBaseUtil {
return result;
}
- public static ChainNodeSpecificDaySummary loadSpecificDaySummary(String keyOfDaySummaryTable, String treeNodeId) throws IOException {
+ public static ChainNodeSpecificDaySummary loadSpecificDaySummary(String keyOfDaySummaryTable, String treeNodeId)
+ throws IOException {
ChainNodeSpecificDaySummary result = null;
Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_DAY_SUMMARY.TABLE_NAME));
Get g = new Get(Bytes.toBytes(keyOfDaySummaryTable));
@@ -144,8 +151,8 @@ public class HBaseUtil {
treeNodeId.getBytes());
if (cell != null && cell.getValueArray().length > 0) {
- result = new ChainNodeSpecificDaySummary(Bytes.toString(cell.getValueArray(),
- cell.getValueOffset(), cell.getValueLength()));
+ result = new ChainNodeSpecificDaySummary(
+ Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
} else {
result = new ChainNodeSpecificDaySummary();
}
@@ -153,9 +160,11 @@ public class HBaseUtil {
return result;
}
- public static ChainNodeSpecificMonthSummary loadSpecificMonthSummary(String keyOfMonthSummaryTable, String treeNodeId) throws IOException {
+ public static ChainNodeSpecificMonthSummary loadSpecificMonthSummary(String keyOfMonthSummaryTable,
+ String treeNodeId) throws IOException {
ChainNodeSpecificMonthSummary result = null;
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.TABLE_NAME));
Get g = new Get(Bytes.toBytes(keyOfMonthSummaryTable));
Result r = table.get(g);
@@ -163,12 +172,13 @@ public class HBaseUtil {
return new ChainNodeSpecificMonthSummary();
}
- Cell cell = r.getColumnLatestCell(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.COLUMN_FAMILY_NAME.getBytes(),
- treeNodeId.getBytes());
+ Cell cell =
+ r.getColumnLatestCell(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.COLUMN_FAMILY_NAME.getBytes(),
+ treeNodeId.getBytes());
if (cell != null && cell.getValueArray().length > 0) {
- result = new ChainNodeSpecificMonthSummary(Bytes.toString(cell.getValueArray(),
- cell.getValueOffset(), cell.getValueLength()));
+ result = new ChainNodeSpecificMonthSummary(
+ Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
} else {
result = new ChainNodeSpecificMonthSummary();
}
@@ -178,7 +188,8 @@ public class HBaseUtil {
public static List loadHasBeenMergeChainIds(String treeId) throws IOException {
List result = new ArrayList();
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CALL_CHAIN_TREE_ID_AND_CID_MAPPING.TABLE_NAME));
+ Table table = connection
+ .getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CALL_CHAIN_TREE_ID_AND_CID_MAPPING.TABLE_NAME));
Get g = new Get(Bytes.toBytes(treeId));
Result r = table.get(g);
if (r.rawCells().length == 0) {
@@ -186,10 +197,10 @@ public class HBaseUtil {
}
for (Cell cell : r.rawCells()) {
if (cell.getValueArray().length > 0) {
- List hasBeenMergedCIds = new Gson().fromJson(Bytes.toString(cell.getValueArray(),
- cell.getValueOffset(), cell.getValueLength()),
- new TypeToken>() {
- }.getType());
+ List hasBeenMergedCIds = new Gson()
+ .fromJson(Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()),
+ new TypeToken>() {
+ }.getType());
result.addAll(hasBeenMergedCIds);
}
@@ -198,12 +209,14 @@ public class HBaseUtil {
}
public static void batchSaveMinSummaryResult(List puts) throws IOException, InterruptedException {
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MINUTE_SUMMARY.TABLE_NAME));
batchSaveData(puts, table);
}
public static void batchSaveMonthSummaryResult(List puts) throws IOException, InterruptedException {
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_MONTH_SUMMARY.TABLE_NAME));
batchSaveData(puts, table);
}
@@ -213,7 +226,8 @@ public class HBaseUtil {
}
public static void batchSaveHourSummaryResult(List puts) throws IOException, InterruptedException {
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_HOUR_SUMMARY.TABLE_NAME));
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CHAIN_ONE_HOUR_SUMMARY.TABLE_NAME));
batchSaveData(puts, table);
}
@@ -235,7 +249,8 @@ public class HBaseUtil {
}
public static void batchSaveHasBeenMergedCID(List chainIdPuts) throws IOException, InterruptedException {
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CALL_CHAIN_TREE_ID_AND_CID_MAPPING.TABLE_NAME));
+ Table table = connection
+ .getTable(TableName.valueOf(HBaseTableMetaData.TABLE_CALL_CHAIN_TREE_ID_AND_CID_MAPPING.TABLE_NAME));
batchSaveData(chainIdPuts, table);
}
@@ -243,13 +258,13 @@ public class HBaseUtil {
public static void saveTraceIdAndTreeIdMapping(String traceId, String cid) throws IOException {
Put put = new Put(traceId.getBytes());
put.addColumn(HBaseTableMetaData.TABLE_TRACE_ID_AND_CID_MAPPING.COLUMN_FAMILY_NAME.getBytes(),
- HBaseTableMetaData.TABLE_TRACE_ID_AND_CID_MAPPING.COLUMN_NAME.getBytes(),
- cid.getBytes());
- Table table = connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_TRACE_ID_AND_CID_MAPPING.TABLE_NAME));
+ HBaseTableMetaData.TABLE_TRACE_ID_AND_CID_MAPPING.COLUMN_NAME.getBytes(), cid.getBytes());
+ Table table =
+ connection.getTable(TableName.valueOf(HBaseTableMetaData.TABLE_TRACE_ID_AND_CID_MAPPING.TABLE_NAME));
table.put(put);
}
- public static List fetchTraceSpansFromHBase(Result value) throws InvalidProtocolBufferException {
+ public static List fetchTraceSpansFromHBase(Result value) throws ConvertFailedException {
List spanList = new ArrayList();
Map ackSpans = new HashMap();
for (Cell cell : value.rawCells()) {
diff --git a/skywalking-collector/pom.xml b/skywalking-collector/pom.xml
index d49082920..70256bcd7 100644
--- a/skywalking-collector/pom.xml
+++ b/skywalking-collector/pom.xml
@@ -12,7 +12,6 @@
skywalking-collector
- skywalking-protocol
skywalking-api
skywalking-sdk-plugin
skywalking-log
diff --git a/skywalking-collector/skywalking-agent/pom.xml b/skywalking-collector/skywalking-agent/pom.xml
index ef9948dbf..7492cbd05 100644
--- a/skywalking-collector/skywalking-agent/pom.xml
+++ b/skywalking-collector/skywalking-agent/pom.xml
@@ -21,8 +21,6 @@
com.ai.cloud.skywalking.api.dependencies.net.bytebuddy
io.netty
com.ai.cloud.skywalking.api.dependencies.io.netty
- com.google.protobuf
- com.ai.cloud.skywalking.api.dependencies.google.protobuf
com.google.gson
com.ai.cloud.skywalking.api.dependencies.com.google.gson
@@ -91,10 +89,6 @@
${shade.io.netty.source}
${shade.io.netty.target}
-
- ${shade.com.google.protobuf.source}
- ${shade.com.google.protobuf.target}
-
${shade.com.google.gson.source}
${shade.com.google.gson.target}
diff --git a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/BaseInvokeMonitor.java b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/BaseInvokeMonitor.java
index 5209082e7..83b08d7a2 100644
--- a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/BaseInvokeMonitor.java
+++ b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/BaseInvokeMonitor.java
@@ -11,6 +11,7 @@ import com.ai.cloud.skywalking.model.Identification;
import com.ai.cloud.skywalking.protocol.AckSpan;
import com.ai.cloud.skywalking.protocol.RequestSpan;
import com.ai.cloud.skywalking.protocol.Span;
+import com.ai.cloud.skywalking.protocol.util.BuriedPointMachineUtil;
import java.util.HashSet;
import java.util.Set;
@@ -31,14 +32,15 @@ public abstract class BaseInvokeMonitor {
+ spanData.getParentLevel() + "\tLevelId:" + spanData.getLevelId());
}
+ // 将新创建的Context存放到ThreadLocal栈中。
+ CurrentThreadSpanStack.push(spanData);
// 根据SpanData生成RequestSpan,并保存
ContextBuffer.save(RequestSpan.RequestSpanBuilder.
- newBuilder(spanData).callType(id.getCallType()).viewPoint(id.getViewPoint())
- .spanTypeDesc(id.getSpanTypeDesc()).build());
+ newBuilder(CurrentThreadSpanStack.peek()).callType(id.getCallType()).viewPoint(id.getViewPoint())
+ .spanTypeDesc(id.getSpanTypeDesc()).processNo(BuriedPointMachineUtil.getProcessNo())
+ .address(BuriedPointMachineUtil.getHostDesc()).build());
- // 将新创建的Context存放到ThreadLocal栈中。
- CurrentThreadSpanStack.push(spanData);
// 并将当前的Context返回回去
return new ContextData(spanData);
}
diff --git a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/RPCClientInvokeMonitor.java b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/RPCClientInvokeMonitor.java
index a6f63310d..b9412d407 100644
--- a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/RPCClientInvokeMonitor.java
+++ b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/invoke/monitor/RPCClientInvokeMonitor.java
@@ -11,6 +11,7 @@ import com.ai.cloud.skywalking.model.Identification;
import com.ai.cloud.skywalking.protocol.RequestSpan;
import com.ai.cloud.skywalking.protocol.Span;
import com.ai.cloud.skywalking.protocol.common.SpanType;
+import com.ai.cloud.skywalking.protocol.util.BuriedPointMachineUtil;
import com.ai.cloud.skywalking.protocol.util.ContextGenerator;
public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
@@ -27,15 +28,18 @@ public class RPCClientInvokeMonitor extends BaseInvokeMonitor {
//设置SpanType的类型
spanData.setSpanType(SpanType.RPC_CLIENT);
- RequestSpan requestSpan = RequestSpan.RequestSpanBuilder.newBuilder(spanData)
+
+ CurrentThreadSpanStack.push(spanData);
+
+ RequestSpan requestSpan = RequestSpan.RequestSpanBuilder.newBuilder(CurrentThreadSpanStack.peek())
.viewPoint(id.getViewPoint())
.spanTypeDesc(id.getSpanTypeDesc())
.bussinessKey(id.getBusinessKey())
- .callType(id.getCallType())
+ .callType(id.getCallType()).processNo(BuriedPointMachineUtil.getProcessNo())
+ .address(BuriedPointMachineUtil.getHostDesc())
.parameters(id.getParameters()).build();
ContextBuffer.save(requestSpan);
- CurrentThreadSpanStack.push(spanData);
return new ContextData(spanData.getTraceId(), generateSubParentLevelId(spanData));
} catch (Throwable t) {
diff --git a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/logging/Logger.java b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/logging/Logger.java
index bb14d8841..950761f35 100644
--- a/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/logging/Logger.java
+++ b/skywalking-collector/skywalking-api/src/main/java/com/ai/cloud/skywalking/logging/Logger.java
@@ -89,7 +89,7 @@ public class Logger {
break;
}
- tmpMessage = tmpMessage.replaceFirst("\\{\\}", parameters[parametersIndex++].toString());
+ tmpMessage = tmpMessage.replaceFirst("\\{\\}", String.valueOf(parameters[parametersIndex++]));
startSize = index + 2;
}
return tmpMessage;
diff --git a/skywalking-collector/skywalking-api/src/test/java/com/ai/cloud/skywalking/context/CurrentThreadSpanStackTest.java b/skywalking-collector/skywalking-api/src/test/java/com/ai/cloud/skywalking/context/CurrentThreadSpanStackTest.java
new file mode 100644
index 000000000..e9c780566
--- /dev/null
+++ b/skywalking-collector/skywalking-api/src/test/java/com/ai/cloud/skywalking/context/CurrentThreadSpanStackTest.java
@@ -0,0 +1,33 @@
+package com.ai.cloud.skywalking.context;
+
+import com.ai.cloud.skywalking.protocol.Span;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.verify;
+
+public class CurrentThreadSpanStackTest {
+
+ @Test
+ public void testStack(){
+ Span rootSpan = new Span("test","test","Test");
+ Span subSpan1 = new Span("test","0", 10, "test","Test");
+ Span subSpan2 = new Span("test","0", 10, "test","Test");
+ CurrentThreadSpanStack.push(rootSpan);
+
+ CurrentThreadSpanStack.push(subSpan1);
+ Span span = CurrentThreadSpanStack.peek();
+ assertEquals(0, span.getLevelId());
+ CurrentThreadSpanStack.pop();
+
+ CurrentThreadSpanStack.push(subSpan2);
+ span = CurrentThreadSpanStack.peek();
+ assertEquals(1, span.getLevelId());
+ CurrentThreadSpanStack.pop();
+
+ CurrentThreadSpanStack.pop();
+ }
+
+
+}
diff --git a/skywalking-collector/skywalking-protocol/pom.xml b/skywalking-collector/skywalking-protocol/pom.xml
deleted file mode 100644
index bba884047..000000000
--- a/skywalking-collector/skywalking-protocol/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-
- 4.0.0
-
-
- com.ai.cloud
- skywalking-collector
- 1.0-Final
-
-
- skywalking-protocol
- http://maven.apache.org
- skywalking-protocol
- jar
-
-
- UTF-8
-
-
-
-
- com.google.protobuf
- protobuf-java
- 3.0.0
-
-
-
- junit
- junit
- 4.12
- test
-
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 1.9.1
-
-
- add-source
- generate-sources
-
- add-source
-
-
-
- ${project.basedir}/src/main/gen-java
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 2.4.3
-
- ${project.build.sourceEncoding}
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
-
-
-
- attach-sources
-
- jar
-
-
-
- 2.4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- bintray-wu-sheng-sky-walking-repository
- wu-sheng-sky-walking-repository
- https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1
-
-
-
diff --git a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java
index 37f3b854a..09af78806 100644
--- a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java
+++ b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/AbstractDatabasePluginDefine.java
@@ -12,6 +12,6 @@ public abstract class AbstractDatabasePluginDefine extends ClassInstanceMethodsE
@Override
protected String getInstanceMethodsInterceptor() {
- return "com.ai.cloud.skywalking.plugin.jdbc.define.DatabasePluginInterceptor";
+ return "com.ai.cloud.skywalking.plugin.jdbc.define.JDBCDriverInterceptor";
}
}
diff --git a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/JDBCDriverInterceptor.java b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/JDBCDriverInterceptor.java
index 6213af823..146e707e3 100644
--- a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/JDBCDriverInterceptor.java
+++ b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/java/com/ai/cloud/skywalking/plugin/jdbc/define/JDBCDriverInterceptor.java
@@ -18,7 +18,6 @@ public class JDBCDriverInterceptor implements InstanceMethodsAroundInterceptor {
@Override
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
MethodInterceptResult result) {
- System.out.println("Data/////");
}
@Override
diff --git a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/resources/skywalking-plugin.def b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/resources/skywalking-plugin.def
index 1fb34b67d..e96331e1b 100644
--- a/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/resources/skywalking-plugin.def
+++ b/skywalking-collector/skywalking-sdk-plugin/jdbc-plugin/src/main/resources/skywalking-plugin.def
@@ -1,3 +1,3 @@
-com.ai.cloud.skywalking.plugin.jdbc.define.H2DatabasePluginDefine
+com.ai.cloud.skywalking.plugin.jdbc.define.H2PluginDefine
com.ai.cloud.skywalking.plugin.jdbc.define.MysqlPluginDefine
com.ai.cloud.skywalking.plugin.jdbc.define.OraclePluginDefine
diff --git a/skywalking-protocol/dependency-reduced-pom.xml b/skywalking-protocol/dependency-reduced-pom.xml
new file mode 100644
index 000000000..70f12e546
--- /dev/null
+++ b/skywalking-protocol/dependency-reduced-pom.xml
@@ -0,0 +1,102 @@
+
+
+ 4.0.0
+ com.ai.cloud
+ skywalking-protocol
+ skywalking-protocol
+ 1.0-Final
+ http://maven.apache.org
+
+
+
+ maven-shade-plugin
+ 2.4.1
+
+
+ package
+
+ shade
+
+
+ false
+ true
+ true
+ true
+
+
+ ${shade.com.google.protobuf.source}
+ ${shade.com.google.protobuf.target}
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.9.1
+
+
+ add-source
+ generate-sources
+
+ add-source
+
+
+
+ ${project.basedir}/src/main/gen-java
+
+
+
+
+
+
+ maven-resources-plugin
+ 2.4.3
+
+ ${project.build.sourceEncoding}
+
+
+
+ maven-source-plugin
+ 2.4
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ hamcrest-core
+ org.hamcrest
+
+
+
+
+
+
+ bintray-wu-sheng-sky-walking-repository
+ wu-sheng-sky-walking-repository
+ https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1
+
+
+
+ com.google.protobuf
+ com.ai.cloud.skywalking.protocol.dependencies.com.google.protobuf
+ UTF-8
+
+
+
diff --git a/skywalking-protocol/pom.xml b/skywalking-protocol/pom.xml
new file mode 100644
index 000000000..39a4b7801
--- /dev/null
+++ b/skywalking-protocol/pom.xml
@@ -0,0 +1,145 @@
+
+ 4.0.0
+
+ com.ai.cloud
+ 1.0-Final
+
+ skywalking-protocol
+ http://maven.apache.org
+ skywalking-protocol
+ jar
+
+
+ UTF-8
+ com.google.protobuf
+ com.ai.cloud.skywalking.protocol.dependencies.com.google.protobuf
+
+
+
+
+ com.google.protobuf
+ protobuf-java
+ 3.0.0
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.1
+
+
+ package
+
+ shade
+
+
+ false
+ true
+ true
+ true
+
+
+ ${shade.com.google.protobuf.source}
+ ${shade.com.google.protobuf.target}
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.9.1
+
+
+ add-source
+ generate-sources
+
+ add-source
+
+
+
+ ${project.basedir}/src/main/gen-java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.4.3
+
+ ${project.build.sourceEncoding}
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+
+ attach-sources
+
+ jar
+
+
+
+ 2.4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bintray-wu-sheng-sky-walking-repository
+ wu-sheng-sky-walking-repository
+ https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1
+
+
+
diff --git a/skywalking-collector/skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java b/skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java
similarity index 92%
rename from skywalking-collector/skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java
rename to skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java
index 2d613035b..87c0f2a96 100644
--- a/skywalking-collector/skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java
+++ b/skywalking-protocol/src/main/gen-java/com/ai/cloud/skywalking/protocol/proto/TraceProtocol.java
@@ -1540,6 +1540,34 @@ public final class TraceProtocol {
java.lang.String getParametersOrThrow(
java.lang.String key);
+
+ /**
+ * required string processNo = 14;
+ */
+ boolean hasProcessNo();
+ /**
+ * required string processNo = 14;
+ */
+ java.lang.String getProcessNo();
+ /**
+ * required string processNo = 14;
+ */
+ com.google.protobuf.ByteString
+ getProcessNoBytes();
+
+ /**
+ * required string address = 15;
+ */
+ boolean hasAddress();
+ /**
+ * required string address = 15;
+ */
+ java.lang.String getAddress();
+ /**
+ * required string address = 15;
+ */
+ com.google.protobuf.ByteString
+ getAddressBytes();
}
/**
* Protobuf type {@code RequestSpan}
@@ -1565,6 +1593,8 @@ public final class TraceProtocol {
userId_ = "";
bussinessKey_ = "";
agentId_ = "";
+ processNo_ = "";
+ address_ = "";
}
@java.lang.Override
@@ -1676,6 +1706,18 @@ public final class TraceProtocol {
parameters_.getMutableMap().put(parameters.getKey(), parameters.getValue());
break;
}
+ case 114: {
+ com.google.protobuf.ByteString bs = input.readBytes();
+ bitField0_ |= 0x00001000;
+ processNo_ = bs;
+ break;
+ }
+ case 122: {
+ com.google.protobuf.ByteString bs = input.readBytes();
+ bitField0_ |= 0x00002000;
+ address_ = bs;
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -2211,6 +2253,90 @@ public final class TraceProtocol {
return map.get(key);
}
+ public static final int PROCESSNO_FIELD_NUMBER = 14;
+ private volatile java.lang.Object processNo_;
+ /**
+ * required string processNo = 14;
+ */
+ public boolean hasProcessNo() {
+ return ((bitField0_ & 0x00001000) == 0x00001000);
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public java.lang.String getProcessNo() {
+ java.lang.Object ref = processNo_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ processNo_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public com.google.protobuf.ByteString
+ getProcessNoBytes() {
+ java.lang.Object ref = processNo_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ processNo_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int ADDRESS_FIELD_NUMBER = 15;
+ private volatile java.lang.Object address_;
+ /**
+ * required string address = 15;
+ */
+ public boolean hasAddress() {
+ return ((bitField0_ & 0x00002000) == 0x00002000);
+ }
+ /**
+ * required string address = 15;
+ */
+ public java.lang.String getAddress() {
+ java.lang.Object ref = address_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ address_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string address = 15;
+ */
+ public com.google.protobuf.ByteString
+ getAddressBytes() {
+ java.lang.Object ref = address_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ address_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
@@ -2257,6 +2383,14 @@ public final class TraceProtocol {
memoizedIsInitialized = 0;
return false;
}
+ if (!hasProcessNo()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasAddress()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
@@ -2308,6 +2442,12 @@ public final class TraceProtocol {
.build();
output.writeMessage(13, parameters);
}
+ if (((bitField0_ & 0x00001000) == 0x00001000)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 14, processNo_);
+ }
+ if (((bitField0_ & 0x00002000) == 0x00002000)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 15, address_);
+ }
unknownFields.writeTo(output);
}
@@ -2365,6 +2505,12 @@ public final class TraceProtocol {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(13, parameters);
}
+ if (((bitField0_ & 0x00001000) == 0x00001000)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, processNo_);
+ }
+ if (((bitField0_ & 0x00002000) == 0x00002000)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, address_);
+ }
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
@@ -2444,6 +2590,16 @@ public final class TraceProtocol {
}
result = result && internalGetParameters().equals(
other.internalGetParameters());
+ result = result && (hasProcessNo() == other.hasProcessNo());
+ if (hasProcessNo()) {
+ result = result && getProcessNo()
+ .equals(other.getProcessNo());
+ }
+ result = result && (hasAddress() == other.hasAddress());
+ if (hasAddress()) {
+ result = result && getAddress()
+ .equals(other.getAddress());
+ }
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@@ -2508,6 +2664,14 @@ public final class TraceProtocol {
hash = (37 * hash) + PARAMETERS_FIELD_NUMBER;
hash = (53 * hash) + internalGetParameters().hashCode();
}
+ if (hasProcessNo()) {
+ hash = (37 * hash) + PROCESSNO_FIELD_NUMBER;
+ hash = (53 * hash) + getProcessNo().hashCode();
+ }
+ if (hasAddress()) {
+ hash = (37 * hash) + ADDRESS_FIELD_NUMBER;
+ hash = (53 * hash) + getAddress().hashCode();
+ }
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
@@ -2673,6 +2837,10 @@ public final class TraceProtocol {
agentId_ = "";
bitField0_ = (bitField0_ & ~0x00000800);
internalGetMutableParameters().clear();
+ processNo_ = "";
+ bitField0_ = (bitField0_ & ~0x00002000);
+ address_ = "";
+ bitField0_ = (bitField0_ & ~0x00004000);
return this;
}
@@ -2747,6 +2915,14 @@ public final class TraceProtocol {
result.agentId_ = agentId_;
result.parameters_ = internalGetParameters();
result.parameters_.makeImmutable();
+ if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
+ to_bitField0_ |= 0x00001000;
+ }
+ result.processNo_ = processNo_;
+ if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
+ to_bitField0_ |= 0x00002000;
+ }
+ result.address_ = address_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -2845,6 +3021,16 @@ public final class TraceProtocol {
}
internalGetMutableParameters().mergeFrom(
other.internalGetParameters());
+ if (other.hasProcessNo()) {
+ bitField0_ |= 0x00002000;
+ processNo_ = other.processNo_;
+ onChanged();
+ }
+ if (other.hasAddress()) {
+ bitField0_ |= 0x00004000;
+ address_ = other.address_;
+ onChanged();
+ }
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
@@ -2881,6 +3067,12 @@ public final class TraceProtocol {
if (!hasAgentId()) {
return false;
}
+ if (!hasProcessNo()) {
+ return false;
+ }
+ if (!hasAddress()) {
+ return false;
+ }
return true;
}
@@ -3801,6 +3993,158 @@ public final class TraceProtocol {
getMutableParameters().putAll(values);
return this;
}
+
+ private java.lang.Object processNo_ = "";
+ /**
+ * required string processNo = 14;
+ */
+ public boolean hasProcessNo() {
+ return ((bitField0_ & 0x00002000) == 0x00002000);
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public java.lang.String getProcessNo() {
+ java.lang.Object ref = processNo_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ processNo_ = s;
+ }
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public com.google.protobuf.ByteString
+ getProcessNoBytes() {
+ java.lang.Object ref = processNo_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ processNo_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public Builder setProcessNo(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00002000;
+ processNo_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public Builder clearProcessNo() {
+ bitField0_ = (bitField0_ & ~0x00002000);
+ processNo_ = getDefaultInstance().getProcessNo();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string processNo = 14;
+ */
+ public Builder setProcessNoBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00002000;
+ processNo_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object address_ = "";
+ /**
+ * required string address = 15;
+ */
+ public boolean hasAddress() {
+ return ((bitField0_ & 0x00004000) == 0x00004000);
+ }
+ /**
+ * required string address = 15;
+ */
+ public java.lang.String getAddress() {
+ java.lang.Object ref = address_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ address_ = s;
+ }
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string address = 15;
+ */
+ public com.google.protobuf.ByteString
+ getAddressBytes() {
+ java.lang.Object ref = address_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ address_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string address = 15;
+ */
+ public Builder setAddress(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00004000;
+ address_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string address = 15;
+ */
+ public Builder clearAddress() {
+ bitField0_ = (bitField0_ & ~0x00004000);
+ address_ = getDefaultInstance().getAddress();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string address = 15;
+ */
+ public Builder setAddressBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00004000;
+ address_ = value;
+ onChanged();
+ return this;
+ }
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
@@ -3878,16 +4222,17 @@ public final class TraceProtocol {
"ceId\030\001 \002(\t\022\023\n\013parentLevel\030\002 \001(\t\022\017\n\007level" +
"Id\030\003 \002(\005\022\014\n\004cost\030\004 \002(\003\022\022\n\nstatusCode\030\005 \002" +
"(\005\022\026\n\016exceptionStack\030\006 \001(\t\022\023\n\013viewpointI" +
- "d\030\007 \002(\t\"\331\002\n\013RequestSpan\022\017\n\007traceId\030\001 \002(\t" +
+ "d\030\007 \002(\t\"\375\002\n\013RequestSpan\022\017\n\007traceId\030\001 \002(\t" +
"\022\023\n\013parentLevel\030\002 \001(\t\022\017\n\007levelId\030\003 \002(\005\022\023" +
"\n\013viewPointId\030\004 \002(\t\022\021\n\tstartDate\030\005 \002(\003\022\024" +
"\n\014spanTypeDesc\030\006 \002(\t\022\020\n\010callType\030\007 \002(\t\022\020" +
"\n\010spanType\030\010 \002(\r\022\025\n\rapplicationId\030\t \002(\t\022" +
"\016\n\006userId\030\n \002(\t\022\024\n\014bussinessKey\030\013 \001(\t\022\017\n",
"\007agentId\030\014 \002(\t\0220\n\nparameters\030\r \003(\0132\034.Req" +
- "uestSpan.ParametersEntry\0321\n\017ParametersEn" +
- "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B(\n&c" +
- "om.ai.cloud.skywalking.protocol.proto"
+ "uestSpan.ParametersEntry\022\021\n\tprocessNo\030\016 " +
+ "\002(\t\022\017\n\007address\030\017 \002(\t\0321\n\017ParametersEntry\022" +
+ "\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001B(\n&com.a" +
+ "i.cloud.skywalking.protocol.proto"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -3912,7 +4257,7 @@ public final class TraceProtocol {
internal_static_RequestSpan_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_RequestSpan_descriptor,
- new java.lang.String[] { "TraceId", "ParentLevel", "LevelId", "ViewPointId", "StartDate", "SpanTypeDesc", "CallType", "SpanType", "ApplicationId", "UserId", "BussinessKey", "AgentId", "Parameters", });
+ new java.lang.String[] { "TraceId", "ParentLevel", "LevelId", "ViewPointId", "StartDate", "SpanTypeDesc", "CallType", "SpanType", "ApplicationId", "UserId", "BussinessKey", "AgentId", "Parameters", "ProcessNo", "Address", });
internal_static_RequestSpan_ParametersEntry_descriptor =
internal_static_RequestSpan_descriptor.getNestedTypes().get(0);
internal_static_RequestSpan_ParametersEntry_fieldAccessorTable = new
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java
similarity index 99%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java
index f567e3bb8..e02466b64 100644
--- a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java
+++ b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/AckSpan.java
@@ -175,7 +175,6 @@ public class AckSpan extends AbstractDataSerializable {
return ackSpan;
}
- @Override
public boolean isNull() {
return false;
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java
similarity index 97%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java
index 745bdbd89..288a32420 100644
--- a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java
+++ b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/BufferFileEOFProtocol.java
@@ -19,7 +19,6 @@ public class BufferFileEOFProtocol extends AbstractDataSerializable {
return new BufferFileEOFProtocol();
}
- @Override
public boolean isNull() {
return false;
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java
similarity index 72%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java
index b59652ff6..2e59d070a 100644
--- a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java
+++ b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/FullSpan.java
@@ -1,27 +1,31 @@
package com.ai.cloud.skywalking.protocol;
+import com.ai.cloud.skywalking.protocol.common.SpanType;
+
public class FullSpan {
- private String traceId;
- private String parentLevel = "";
- private int levelId = 0;
- private String viewPointId;
- private String applicationId;
- private String callType;
- private long cost;
- private String businessKey;
- private String exceptionStack;
- private byte statusCode = 0;
- private String spanTypeDesc;
- private String userId;
- private long startDate;
- private String spanType;
+ protected String traceId;
+ protected String parentLevel = "";
+ protected int levelId = 0;
+ protected String viewPointId;
+ protected String applicationId;
+ protected String callType;
+ protected long cost;
+ protected String businessKey;
+ protected String exceptionStack;
+ protected byte statusCode = 0;
+ protected String spanTypeDesc;
+ protected String userId;
+ protected long startDate;
+ protected String spanType;
+ protected String address = "";
+ protected String processNo = "";
public FullSpan() {
}
- public FullSpan(RequestSpan span) {
+ public FullSpan(RequestSpan span, AckSpan ackSpan) {
this.traceId = span.getTraceId();
this.parentLevel = span.getParentLevel();
this.levelId = span.getLevelId();
@@ -31,6 +35,16 @@ public class FullSpan {
this.spanTypeDesc = span.getSpanTypeDesc();
this.userId = span.getUserId();
this.startDate = span.getStartDate();
+ this.viewPointId = span.getViewPointId();
+ this.spanType = span.getSpanType() + "";
+ this.address = span.getAddress();
+ this.processNo = span.getProcessNo();
+
+ if (ackSpan != null) {
+ this.cost = ackSpan.getCost();
+ this.exceptionStack = ackSpan.getExceptionStack();
+ this.statusCode = ackSpan.getStatusCode();
+ }
}
public String getTraceId() {
@@ -116,14 +130,6 @@ public class FullSpan {
return getLevelId() + "";
}
- public void addAckSpan(AckSpan ackSpan) {
- if (ackSpan != null) {
- this.cost = ackSpan.getCost();
- this.exceptionStack = ackSpan.getExceptionStack();
- this.statusCode = ackSpan.getStatusCode();
- }
- }
-
public void setParentLevel(String parentLevel) {
this.parentLevel = parentLevel;
}
@@ -131,4 +137,12 @@ public class FullSpan {
public void setViewPointId(String viewPointId) {
this.viewPointId = viewPointId;
}
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getProcessNo() {
+ return processNo;
+ }
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/NullClass.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/NullClass.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/NullClass.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/NullClass.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java
similarity index 84%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java
index 1329f8a23..cb846d579 100644
--- a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java
+++ b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/RequestSpan.java
@@ -85,6 +85,17 @@ public class RequestSpan extends AbstractDataSerializable {
*/
private String agentId = "";
+ /**
+ * 节点调用的所在进程号
+ */
+ protected String processNo = "";
+
+ /**
+ * 节点调用的发生机器描述
+ * 包含机器名 + IP地址
+ */
+ protected String address = "";
+
public RequestSpan(Span spanData) {
this.traceId = spanData.getTraceId();
this.parentLevel = spanData.getParentLevel();
@@ -117,6 +128,8 @@ public class RequestSpan extends AbstractDataSerializable {
this.setViewPointId(requestSpanByte.getViewPointId());
this.setBusinessKey(requestSpanByte.getBussinessKey());
this.setAgentId(requestSpanByte.getAgentId());
+ this.setProcessNo(requestSpanByte.getProcessNo());
+ this.setAddress(requestSpanByte.getAddress());
}
private boolean isEntrySpan() {
@@ -221,7 +234,8 @@ public class RequestSpan extends AbstractDataSerializable {
TraceProtocol.RequestSpan.Builder builder =
TraceProtocol.RequestSpan.newBuilder().setTraceId(traceId).setParentLevel(parentLevel)
.setLevelId(levelId).setViewPointId(viewPointId).setStartDate(startDate)
- .setSpanType(spanType.getValue()).setSpanTypeDesc(spanTypeDesc);
+ .setSpanType(spanType.getValue()).setSpanTypeDesc(spanTypeDesc).setAddress(address)
+ .setProcessNo(processNo);
if (businessKey != null && businessKey.length() > 0) {
builder.setBussinessKey(businessKey);
}
@@ -251,6 +265,8 @@ public class RequestSpan extends AbstractDataSerializable {
requestSpan.setViewPointId(requestSpanByte.getViewPointId());
requestSpan.setBusinessKey(requestSpanByte.getBussinessKey());
requestSpan.setAgentId(requestSpanByte.getAgentId());
+ requestSpan.setProcessNo(requestSpanByte.getProcessNo());
+ requestSpan.setAddress(requestSpanByte.getAddress());
} catch (InvalidProtocolBufferException e) {
throw new ConvertFailedException(e.getMessage(), e);
}
@@ -258,11 +274,6 @@ public class RequestSpan extends AbstractDataSerializable {
return requestSpan;
}
- @Override
- public boolean isNull() {
- return false;
- }
-
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
@@ -275,11 +286,15 @@ public class RequestSpan extends AbstractDataSerializable {
this.agentId = agentId;
}
+ public boolean isNull() {
+ return false;
+ }
+
public static class RequestSpanBuilder {
- private RequestSpan ackSpan;
+ private RequestSpan requestSpan;
private RequestSpanBuilder(Span span) {
- ackSpan = new RequestSpan(span);
+ requestSpan = new RequestSpan(span);
}
public static RequestSpanBuilder newBuilder(Span span) {
@@ -287,44 +302,54 @@ public class RequestSpan extends AbstractDataSerializable {
}
public RequestSpanBuilder applicationId(String applicationId) {
- ackSpan.applicationId = applicationId;
+ requestSpan.applicationId = applicationId;
return this;
}
public RequestSpanBuilder callType(String callType) {
- ackSpan.callType = callType;
+ requestSpan.callType = callType;
return this;
}
public RequestSpanBuilder spanTypeDesc(String spanTypeDesc) {
- ackSpan.spanTypeDesc = spanTypeDesc;
+ requestSpan.spanTypeDesc = spanTypeDesc;
return this;
}
public RequestSpanBuilder userId(String userId) {
- ackSpan.userId = userId;
+ requestSpan.userId = userId;
return this;
}
public RequestSpanBuilder bussinessKey(String bussinessKey) {
- ackSpan.businessKey = bussinessKey;
+ requestSpan.businessKey = bussinessKey;
return this;
}
public RequestSpanBuilder parameters(Map parameters) {
- if (ackSpan.isEntrySpan()) {
- ackSpan.parameters = parameters;
+ if (requestSpan.isEntrySpan()) {
+ requestSpan.parameters = parameters;
}
return this;
}
public RequestSpan build() {
- return ackSpan;
+ return requestSpan;
}
public RequestSpanBuilder viewPoint(String viewPoint) {
- ackSpan.viewPointId = viewPoint;
+ requestSpan.viewPointId = viewPoint;
+ return this;
+ }
+
+ public RequestSpanBuilder processNo(String processNo){
+ requestSpan.processNo = processNo;
+ return this;
+ }
+
+ public RequestSpanBuilder address(String address){
+ requestSpan.address = address;
return this;
}
}
@@ -333,4 +358,19 @@ public class RequestSpan extends AbstractDataSerializable {
return businessKey;
}
+ public String getProcessNo() {
+ return processNo;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setProcessNo(String processNo) {
+ this.processNo = processNo;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/SerializedFactory.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/SerializedFactory.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/SerializedFactory.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/SerializedFactory.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/Span.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/TransportPackager.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/TransportPackager.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/TransportPackager.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/TransportPackager.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/AbstractDataSerializable.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/AbstractDataSerializable.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/AbstractDataSerializable.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/AbstractDataSerializable.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/CallType.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/CallType.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/CallType.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/CallType.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/ISerializable.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/ISerializable.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/ISerializable.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/ISerializable.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/NullableClass.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/NullableClass.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/NullableClass.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/NullableClass.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java
similarity index 99%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java
index d864e4df3..ca1f4dc4c 100644
--- a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java
+++ b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/common/SpanType.java
@@ -34,4 +34,6 @@ public enum SpanType {
public int getValue() {
return value;
}
+
+
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/ConvertFailedException.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/ConvertFailedException.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/ConvertFailedException.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/ConvertFailedException.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SerializableDataTypeRegisterException.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SerializableDataTypeRegisterException.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SerializableDataTypeRegisterException.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SerializableDataTypeRegisterException.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SpanTypeCannotConvertException.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SpanTypeCannotConvertException.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SpanTypeCannotConvertException.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/exception/SpanTypeCannotConvertException.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/AtomicRangeInteger.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/AtomicRangeInteger.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/AtomicRangeInteger.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/AtomicRangeInteger.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/ByteDataUtil.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/ByteDataUtil.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/ByteDataUtil.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/ByteDataUtil.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/IntegerAssist.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/IntegerAssist.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/IntegerAssist.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/IntegerAssist.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/SpanLevelIdComparators.java b/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/SpanLevelIdComparators.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/SpanLevelIdComparators.java
rename to skywalking-protocol/src/main/java/com/ai/cloud/skywalking/protocol/util/SpanLevelIdComparators.java
diff --git a/skywalking-collector/skywalking-protocol/src/main/proto/TraceProtocol.proto b/skywalking-protocol/src/main/proto/TraceProtocol.proto
similarity index 92%
rename from skywalking-collector/skywalking-protocol/src/main/proto/TraceProtocol.proto
rename to skywalking-protocol/src/main/proto/TraceProtocol.proto
index 4f0653f80..8fb195176 100644
--- a/skywalking-collector/skywalking-protocol/src/main/proto/TraceProtocol.proto
+++ b/skywalking-protocol/src/main/proto/TraceProtocol.proto
@@ -26,4 +26,6 @@ message RequestSpan {
optional string bussinessKey = 11;
required string agentId = 12;
map parameters = 13;
+ required string processNo = 14;
+ required string address = 15;
}
diff --git a/skywalking-collector/skywalking-protocol/src/main/resources/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable b/skywalking-protocol/src/main/resources/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/main/resources/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable
rename to skywalking-protocol/src/main/resources/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable
diff --git a/skywalking-collector/skywalking-protocol/src/test/java/test/ai/cloud/skywalking/util/AtomicRangeIntegerTest.java b/skywalking-protocol/src/test/java/test/ai/cloud/skywalking/util/AtomicRangeIntegerTest.java
similarity index 100%
rename from skywalking-collector/skywalking-protocol/src/test/java/test/ai/cloud/skywalking/util/AtomicRangeIntegerTest.java
rename to skywalking-protocol/src/test/java/test/ai/cloud/skywalking/util/AtomicRangeIntegerTest.java
diff --git a/skywalking-protocol/target/classes/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable b/skywalking-protocol/target/classes/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable
new file mode 100644
index 000000000..06d6b0fe6
--- /dev/null
+++ b/skywalking-protocol/target/classes/META-INF/services/com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable
@@ -0,0 +1,3 @@
+com.ai.cloud.skywalking.protocol.AckSpan
+com.ai.cloud.skywalking.protocol.RequestSpan
+com.ai.cloud.skywalking.protocol.BufferFileEOFProtocol
diff --git a/skywalking-protocol/target/maven-archiver/pom.properties b/skywalking-protocol/target/maven-archiver/pom.properties
new file mode 100644
index 000000000..809c55dbd
--- /dev/null
+++ b/skywalking-protocol/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Aug 10 18:20:13 CST 2016
+version=1.0-Final
+groupId=com.ai.cloud
+artifactId=skywalking-protocol
diff --git a/skywalking-server/pom.xml b/skywalking-server/pom.xml
index aa998daa1..09909fcd5 100644
--- a/skywalking-server/pom.xml
+++ b/skywalking-server/pom.xml
@@ -56,11 +56,6 @@
gson
2.2.2
-
- com.google.protobuf
- protobuf-java
- 3.0.0
-
@@ -127,7 +122,6 @@
*.properties
*.xml
- sky-walking-server
${project.build.directory}/installer/lib
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/OffsetFile.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/OffsetFile.java
index 546aa0f8f..1de6388cb 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/OffsetFile.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/OffsetFile.java
@@ -1,6 +1,7 @@
package com.ai.cloud.skywalking.reciever.peresistent;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
@@ -13,13 +14,20 @@ public class OffsetFile {
private long lastModifyTime;
public OffsetFile(String offsetFileName, List bufferFileNameList) throws IOException {
- BufferedReader reader = new BufferedReader(new FileReader(offsetFileName));
+ File offsetFile = new File(offsetFileName);
+ if (offsetFile.exists()){
+ isComplete = false;
+ return;
+ }
+
+ BufferedReader reader = new BufferedReader(new FileReader(offsetFile));
String offsetData;
String lastModifyTimeStr = reader.readLine();
if (lastModifyTimeStr == null || lastModifyTimeStr.length() == 0) {
isComplete = false;
return;
}
+
lastModifyTime = Long.parseLong(lastModifyTimeStr);
while ((offsetData = reader.readLine()) != null && !"EOF".equals(offsetData)) {
String[] ss = offsetData.split("\t");
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/PersistenceThread.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/PersistenceThread.java
index dc88d939f..80443b75d 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/PersistenceThread.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/peresistent/PersistenceThread.java
@@ -1,5 +1,7 @@
package com.ai.cloud.skywalking.reciever.peresistent;
+import com.ai.cloud.skywalking.protocol.AckSpan;
+import com.ai.cloud.skywalking.protocol.RequestSpan;
import com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable;
import com.ai.cloud.skywalking.reciever.conf.Config;
import com.ai.cloud.skywalking.reciever.processor.IProcessor;
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AbstractSpanProcessor.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AbstractSpanProcessor.java
index 95f5ec147..012055d58 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AbstractSpanProcessor.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AbstractSpanProcessor.java
@@ -7,6 +7,10 @@ import com.ai.cloud.skywalking.reciever.selfexamination.ServerHealthCollector;
import com.ai.cloud.skywalking.reciever.selfexamination.ServerHeathReading;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.logging.log4j.LogManager;
@@ -15,6 +19,8 @@ import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.List;
+import static org.apache.hadoop.hbase.util.Bytes.toBytes;
+
public abstract class AbstractSpanProcessor implements IProcessor {
private static Logger logger = LogManager.getLogger(AbstractSpanProcessor.class);
private static Configuration configuration = null;
@@ -30,17 +36,27 @@ public abstract class AbstractSpanProcessor implements IProcessor {
configuration.set("hbase.zookeeper.quorum", Config.HBaseConfig.ZK_HOSTNAME);
configuration.set("hbase.zookeeper.property.clientPort", Config.HBaseConfig.CLIENT_PORT);
}
+
try {
connection = ConnectionFactory.createConnection(configuration);
+ Admin admin = connection.getAdmin();
+ if (!admin.tableExists(TableName.valueOf(Config.HBaseConfig.TABLE_NAME))){
+ HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf(Config.HBaseConfig.TABLE_NAME));
+ HColumnDescriptor family = new HColumnDescriptor(toBytes(Config.HBaseConfig.FAMILY_COLUMN_NAME));
+ descriptor.addFamily(family);
+ admin.createTable(descriptor);
+ }
} catch (IOException e) {
ServerHealthCollector.getCurrentHeathReading("hbase").updateData(ServerHeathReading.ERROR, "connect to hbase failure.");
throw new HBaseInitFailedException("initHBaseClient failure", e);
}
+
+
}
@Override
public void process(List serializedObjects) {
- doAlarm(serializedObjects);
+ //doAlarm(serializedObjects);
doSaveHBase(connection, serializedObjects);
}
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AckSpanProcessor.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AckSpanProcessor.java
index 8d8d9f74d..ec127fe7b 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AckSpanProcessor.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/AckSpanProcessor.java
@@ -47,6 +47,7 @@ public class AckSpanProcessor extends AbstractSpanProcessor {
String columnName;
for (AbstractDataSerializable serializedObject : serializedObjects) {
AckSpan ackSpan = (AckSpan) serializedObject;
+ System.out.println(ackSpan.getTraceId() + "-ACK:" + ackSpan.getViewPointId());
Put put = new Put(Bytes.toBytes(ackSpan.getTraceId()), getTSBySpanTraceId(ackSpan.getTraceId()));
if (StringUtils.isEmpty(ackSpan.getParentLevel().trim())) {
columnName = ackSpan.getLevelId() + "";
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/RequestSpanProcessor.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/RequestSpanProcessor.java
index e46aa9509..dd67086d5 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/RequestSpanProcessor.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/processor/RequestSpanProcessor.java
@@ -2,6 +2,7 @@ package com.ai.cloud.skywalking.reciever.processor;
import com.ai.cloud.skywalking.protocol.RequestSpan;
import com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
import com.ai.cloud.skywalking.reciever.conf.Config;
import com.ai.cloud.skywalking.reciever.util.HBaseUtil;
import org.apache.commons.lang.StringUtils;
@@ -30,6 +31,9 @@ public class RequestSpanProcessor extends AbstractSpanProcessor {
String columnName;
for (AbstractDataSerializable serializedObject : serializedObjects) {
RequestSpan requestSpan = (RequestSpan) serializedObject;
+ System.out.println(
+ requestSpan.getTraceId() + ":" + requestSpan.getParentLevel() + "." + requestSpan.getLevelId() + ":"
+ + requestSpan.getViewPointId());
Put put = new Put(Bytes.toBytes(requestSpan.getTraceId()), getTSBySpanTraceId(requestSpan.getTraceId()));
if (StringUtils.isEmpty(requestSpan.getParentLevel().trim())) {
columnName = requestSpan.getLevelId() + "";
@@ -38,7 +42,6 @@ public class RequestSpanProcessor extends AbstractSpanProcessor {
}
put.addColumn(Bytes.toBytes(Config.HBaseConfig.FAMILY_COLUMN_NAME), Bytes.toBytes(columnName),
requestSpan.getData());
-
puts.add(put);
}
// save
diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/util/HBaseUtil.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/util/HBaseUtil.java
index 8d357bc15..967b7b177 100644
--- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/util/HBaseUtil.java
+++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/util/HBaseUtil.java
@@ -8,6 +8,7 @@ import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Table;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.message.ObjectArrayMessage;
import java.io.IOException;
import java.util.List;
@@ -20,7 +21,6 @@ public class HBaseUtil {
try {
Table table = connection.getTable(TableName.valueOf(tableName));
table.batch(puts, resultArrays);
- // ignore failed data
} catch (IOException e) {
logger.error("batchSavePuts failure.", e);
} catch (InterruptedException e) {
diff --git a/skywalking-server/src/main/resources/config.properties b/skywalking-server/src/main/resources/config.properties
index 836c0cfe2..673234998 100644
--- a/skywalking-server/src/main/resources/config.properties
+++ b/skywalking-server/src/main/resources/config.properties
@@ -23,7 +23,7 @@ persistence.switch_file_wait_time=5000
#追加EOF标志位的线程数量
persistence.max_append_eof_flags_thread_number=1
#持久化线程个数
-persistence.max_deal_data_thread_number=0
+persistence.max_deal_data_thread_number=1
#偏移量注册文件的目录
registerpersistence.register_file_parent_directory=/tmp/skywalking/data/offset
@@ -36,7 +36,7 @@ registerpersistence.offset_written_file_wait_cycle=5000
#hbase表名
-hbaseconfig.table_name=sw-call-chain-new
+hbaseconfig.table_name=trace-data
#hbase列簇名字
hbaseconfig.family_column_name=call-chain
#hbase zk quorum
diff --git a/skywalking-server/src/main/resources/log4j.properties b/skywalking-server/src/main/resources/log4j.properties
new file mode 100644
index 000000000..14cd87187
--- /dev/null
+++ b/skywalking-server/src/main/resources/log4j.properties
@@ -0,0 +1,13 @@
+# log4j properties #
+
+# logger #
+log4j.rootLogger=DEBUG,CONSOLE
+log4j.logger.org=ON
+#log4j.logger.org.systemgo.devframework=DEBUG
+
+# Console Appender #
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p %c{1}:%L - %m%n
+
diff --git a/skywalking-server/src/main/resources/log4j.xml b/skywalking-server/src/main/resources/log4j.xml
deleted file mode 100644
index d2cef7b5f..000000000
--- a/skywalking-server/src/main/resources/log4j.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/skywalking-server/src/main/resources/log4j2.xml b/skywalking-server/src/main/resources/log4j2.xml
index 97704498b..91e20d37a 100644
--- a/skywalking-server/src/main/resources/log4j2.xml
+++ b/skywalking-server/src/main/resources/log4j2.xml
@@ -1,26 +1,13 @@
-
-
- ../
-
-
-
-
- %d - %c -%-4r [%t] %-5p %x - %m%n
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/skywalking-webui/pom.xml b/skywalking-webui/pom.xml
index d707c45ba..1ad531f21 100644
--- a/skywalking-webui/pom.xml
+++ b/skywalking-webui/pom.xml
@@ -112,11 +112,30 @@
gson
2.2.2
+
+ com.google.protobuf
+ protobuf-java
+ 2.5.0
+
com.zaxxer
HikariCP
2.4.3
+
+ org.powermock
+ powermock-module-junit4
+ 1.6.5
+ test
+
+
+ org.powermock
+ powermock-api-mockito
+ 1.6.5
+ test
+
+
+
-
\ No newline at end of file
+
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/SearchController.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/SearchController.java
index 0fe7ceb9e..31f57d4a9 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/SearchController.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/SearchController.java
@@ -127,30 +127,4 @@ public class SearchController extends BaseController {
}
return jsonObject.toJSONString();
}
-
- private List generateCallChainTree() {
- List acronymousChainTreeWithGuessNodes = new ArrayList();
- BreviaryChainTree chainTree = new BreviaryChainTree("test");
- chainTree.setEntranceViewpoint("test");
- chainTree.setTreeId("test tree id");
- List breviaryChainNodes = new ArrayList<>();
- BreviaryChainNode breviaryChainNode = new BreviaryChainNode("0.0", "test view point id", true);
- BreviaryChainNode breviaryChainNode1 = new BreviaryChainNode("0.0.0", "test view point id", true);
- BreviaryChainNode breviaryChainNode2 = new BreviaryChainNode("0.1", "test view point id", true);
- BreviaryChainNode breviaryChainNode3 = new BreviaryChainNode("0.2", "test view point id", true);
- breviaryChainNodes.add(breviaryChainNode);
- breviaryChainNodes.add(breviaryChainNode1);
- breviaryChainNodes.add(breviaryChainNode2);
- breviaryChainNodes.add(breviaryChainNode3);
- chainTree.setNodes(breviaryChainNodes);
- acronymousChainTreeWithGuessNodes.add(chainTree);
- AnlyResult anlyResult = new AnlyResult();
- anlyResult.setTotalCostTime(1000);
- anlyResult.setTotalCall(20);
- anlyResult.setHumanInterruptionNumber(10);
- anlyResult.setCorrectNumber(10);
- chainTree.setEntranceAnlyResult(anlyResult);
- return acronymousChainTreeWithGuessNodes;
- }
-
}
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandler.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandler.java
new file mode 100644
index 000000000..a3f0db0c9
--- /dev/null
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandler.java
@@ -0,0 +1,53 @@
+package com.ai.cloud.skywalking.web.dao.impl;
+
+import com.ai.cloud.skywalking.protocol.AckSpan;
+import com.ai.cloud.skywalking.protocol.RequestSpan;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
+import com.ai.cloud.skywalking.web.dto.TraceNodeInfo;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
+import org.apache.hadoop.hbase.util.Bytes;
+
+import java.util.*;
+
+public class SpanDataHandler {
+ private Map levelIdToRequestSpans;
+ private Map levelIdToAckSpans;
+
+ public SpanDataHandler() {
+ levelIdToRequestSpans = new HashMap();
+ levelIdToAckSpans = new HashMap();
+ }
+
+ public void addSpan(Cell cell) throws ConvertFailedException {
+ if (cell != null && cell.getValueArray().length > 0) {
+ String colId =
+ Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
+
+ if (colId.endsWith("-ACK")) {
+ levelIdToAckSpans.put(colId.substring(0, colId.length() - 4), convertACKSpan(CellUtil.cloneValue(cell)));
+ } else {
+ levelIdToRequestSpans.put(colId, convertRequestSpan(CellUtil.cloneValue(cell)));
+ }
+ }
+ }
+
+ private RequestSpan convertRequestSpan(byte[] originData) throws ConvertFailedException {
+ return new RequestSpan(originData);
+ }
+
+ private AckSpan convertACKSpan(byte[] originData) throws ConvertFailedException {
+ return new AckSpan(originData);
+ }
+
+ public Map merge() {
+ Map traceNodeInfos = new HashMap();
+ for (Map.Entry entry : levelIdToRequestSpans.entrySet()){
+ TraceNodeInfo traceNodeInfo = new TraceNodeInfo(entry.getValue(), levelIdToAckSpans.get(entry.getKey()));
+ traceNodeInfos.put(entry.getKey(),traceNodeInfo);
+ }
+
+ return traceNodeInfos;
+ }
+
+}
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/TraceNodeDao.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/TraceNodeDao.java
new file mode 100644
index 000000000..dc07f2db6
--- /dev/null
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/TraceNodeDao.java
@@ -0,0 +1,128 @@
+package com.ai.cloud.skywalking.web.dao.impl;
+
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
+import com.ai.cloud.skywalking.web.dto.TraceNodeInfo;
+import com.ai.cloud.skywalking.web.dto.TraceNodesResult;
+import com.ai.cloud.skywalking.web.dao.inter.ITraceNodeDao;
+import com.ai.cloud.skywalking.web.util.Constants;
+import com.ai.cloud.skywalking.web.util.HBaseUtils;
+import com.ai.cloud.skywalking.web.util.SortUtil;
+import com.ai.cloud.skywalking.web.util.StringUtil;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.filter.ColumnCountGetFilter;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by xin on 16-3-30.
+ */
+@Repository
+public class TraceNodeDao implements ITraceNodeDao {
+
+ private String CALL_CHAIN_TABLE_NAME = "trace-data";
+
+ @Autowired
+ private HBaseUtils hBaseUtils;
+
+
+ @Override
+ public TraceNodesResult queryTraceNodesByTraceId(String traceId)
+ throws ConvertFailedException, IOException, IllegalAccessException, NoSuchMethodException,
+ InvocationTargetException {
+ Table table = hBaseUtils.getConnection().getTable(TableName.valueOf(CALL_CHAIN_TABLE_NAME));
+ Get g = new Get(Bytes.toBytes(traceId));
+ g.setFilter(new ColumnCountGetFilter(Constants.MAX_SEARCH_SPAN_SIZE + 1));
+ Result r = table.get(g);
+ Map traceLogMap = new HashMap();
+ Map rpcMap = new HashMap();
+ TraceNodesResult result = new TraceNodesResult();
+ if (r.rawCells().length < Constants.MAX_SEARCH_SPAN_SIZE) {
+ SpanDataHandler spanDataHandler = new SpanDataHandler();
+ for (Cell cell : r.rawCells()) {
+ spanDataHandler.addSpan(cell);
+ }
+
+ for (Map.Entry entry : spanDataHandler.merge().entrySet()){
+ SortUtil.addCurNodeTreeMapKey(traceLogMap, entry.getKey(), entry.getValue());
+ }
+ computeRPCInfo(rpcMap, traceLogMap);
+ result.setOverMaxQueryNodeNumber(false);
+ result.setResult(traceLogMap.values());
+ }else{
+ result.setOverMaxQueryNodeNumber(true);
+ }
+ return result;
+ }
+
+ private static final String[] NODES = new String[] {"0","0-ACK","0.0","0.0-ACK"};
+
+ @Override
+ public Collection queryEntranceNodeByTraceId(String traceId)
+ throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException,
+ ConvertFailedException {
+ Table table = hBaseUtils.getConnection().getTable(TableName.valueOf(CALL_CHAIN_TABLE_NAME));
+ Get g = new Get(Bytes.toBytes(traceId));
+ g.addColumn("call-chain".getBytes(), "0".getBytes());
+ g.addColumn("call-chain".getBytes(), "0.0".getBytes());
+ g.addColumn("call-chain".getBytes(), "0-ACK".getBytes());
+ g.addColumn("call-chain".getBytes(), "0.0-ACK".getBytes());
+ Result r = table.get(g);
+
+ Map traceLogMap = new HashMap();
+ Map rpcMap = new HashMap();
+ SpanDataHandler spanDataHandler = new SpanDataHandler();
+ for (String node : NODES) {
+ Cell cell = r.getColumnLatestCell("call-chain".getBytes(), node.getBytes());
+ spanDataHandler.addSpan(cell);
+ }
+
+ for (Map.Entry entry : spanDataHandler.merge().entrySet()){
+ SortUtil.addCurNodeTreeMapKey(traceLogMap, entry.getKey(), entry.getValue());
+ }
+
+ computeRPCInfo(rpcMap, traceLogMap);
+ return traceLogMap.values();
+ }
+
+ private void computeRPCInfo(Map rpcMap, Map traceLogMap) {
+ // 合并处理
+ if (rpcMap.size() > 0) {
+ for (Map.Entry rpcVO : rpcMap.entrySet()) {
+ String colId = rpcVO.getKey();
+ if (traceLogMap.containsKey(colId)) {
+ TraceNodeInfo logVO = traceLogMap.get(colId);
+ TraceNodeInfo serverLog = rpcVO.getValue();
+ if (StringUtil.isBlank(logVO.getStatusCodeStr()) || Constants.STATUS_CODE_9.equals(logVO.getStatusCodeStr())) {
+ serverLog.setColId(colId);
+ traceLogMap.put(colId, serverLog);
+ } else {
+ TraceNodeInfo clientLog = traceLogMap.get(colId);
+ clientLog.setApplicationIdStr(clientLog.getApplicationIdStr() + " --> " + serverLog.getApplicationIdStr());
+ clientLog.setViewPointId(serverLog.getViewPointId());
+ clientLog.setViewPointIdSub(serverLog.getViewPointIdSub());
+ clientLog.setAddress(serverLog.getAddress());
+ if (StringUtil.isBlank(clientLog.getExceptionStack())) {
+ clientLog.setExceptionStack(serverLog.getExceptionStack());
+ }else{
+ clientLog.setServerExceptionStr(serverLog.getServerExceptionStr());
+ }
+ }
+ logVO.addTimeLine(rpcVO.getValue().getStartDate(), rpcVO.getValue().getCost());
+ } else {
+ traceLogMap.put(colId, rpcVO.getValue());
+ }
+ }
+ }
+ }
+}
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/inter/ITraceNodeDao.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/inter/ITraceNodeDao.java
index b6aae2b2b..2f9747905 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/inter/ITraceNodeDao.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/inter/ITraceNodeDao.java
@@ -1,5 +1,6 @@
package com.ai.cloud.skywalking.web.dao.inter;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
import com.ai.cloud.skywalking.web.dto.TraceNodeInfo;
import com.ai.cloud.skywalking.web.dto.TraceNodesResult;
@@ -12,7 +13,11 @@ import java.util.Collection;
*/
public interface ITraceNodeDao {
- TraceNodesResult queryTraceNodesByTraceId(String traceId) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException;
+ TraceNodesResult queryTraceNodesByTraceId(String traceId)
+ throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException,
+ ConvertFailedException;
- Collection queryEntranceNodeByTraceId(String traceId) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException;
+ Collection queryEntranceNodeByTraceId(String traceId)
+ throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException,
+ ConvertFailedException;
}
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodeInfo.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodeInfo.java
index 1f8cadfcd..54ee499d2 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodeInfo.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodeInfo.java
@@ -1,10 +1,10 @@
package com.ai.cloud.skywalking.web.dto;
+import com.ai.cloud.skywalking.protocol.AckSpan;
import com.ai.cloud.skywalking.protocol.FullSpan;
import com.ai.cloud.skywalking.protocol.RequestSpan;
import com.ai.cloud.skywalking.web.util.Constants;
import com.ai.cloud.skywalking.web.util.StringUtil;
-import com.google.protobuf.InvalidProtocolBufferException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -43,11 +43,48 @@ public class TraceNodeInfo extends FullSpan {
private String serverExceptionStr;
- private TraceNodeInfo(){
+ private TraceNodeInfo() {
+
}
- private TraceNodeInfo(RequestSpan requestSpan) {
- super(requestSpan);
+ public TraceNodeInfo(RequestSpan requestSpan, AckSpan ackSpan) {
+ super(requestSpan, ackSpan);
+ this.colId = requestSpan.getParentLevel() == null || requestSpan.getParentLevel().length() == 0 ?
+ getLevelId() + "" :
+ getParentLevel() + "." + getLevelId();
+
+ // 处理类型key-value
+ String spanTypeStr = String.valueOf(requestSpan.getSpanTypeDesc());
+ if (StringUtil.isBlank(spanTypeStr) || Constants.SPAN_TYPE_MAP.containsKey(spanTypeStr)) {
+ this.spanTypeStr = Constants.SPAN_TYPE_U;
+ }
+ this.spanTypeStr = spanTypeStr;
+ if (Constants.SPAN_TYPE_MAP.containsKey(spanTypeStr)) {
+ this.spanTypeName = Constants.SPAN_TYPE_MAP.get(spanTypeStr);
+ } else {
+ //非默认支持的类型,使用原文中的类型,不需要解析
+ this.spanTypeName = this.spanTypeStr;
+ }
+
+ // 处理状态key-value
+ String statusCodeStr = String.valueOf(getStatusCode());
+ if (StringUtil.isBlank(statusCodeStr) || Constants.STATUS_CODE_MAP.containsKey(statusCodeStr)) {
+ this.statusCodeStr = Constants.STATUS_CODE_9;
+ }
+ String statusCodeName = Constants.STATUS_CODE_MAP.get(statusCodeStr);
+ this.statusCodeStr = statusCodeStr;
+ this.statusCodeName = statusCodeName;
+
+ this.applicationIdStr = this.applicationId;
+ if (!StringUtil.isBlank(this.viewPointId) && this.viewPointId.length() > 60) {
+ this.viewPointIdSub = this.viewPointId.substring(0, 30) + "..." + this.viewPointId
+ .substring(this.viewPointId.length() - 30);
+ } else {
+ this.viewPointIdSub = this.viewPointId;
+ }
+
+ this.addTimeLine(this.startDate, this.cost);
+ this.endDate = this.startDate + this.cost;
}
public String getColId() {
@@ -81,48 +118,6 @@ public class TraceNodeInfo extends FullSpan {
public void setViewPointIdSub(String viewPointIdSub) {
this.viewPointIdSub = viewPointIdSub;
}
-
- private static TraceNodeInfo convert(byte[] originData)
- throws IllegalAccessException, InvocationTargetException, NoSuchMethodException,
- InvalidProtocolBufferException {
- TraceNodeInfo result = new TraceNodeInfo(new RequestSpan(originData));
-
- // 处理类型key-value
- String spanTypeStr = String.valueOf(result.getSpanType());
- if (StringUtil.isBlank(spanTypeStr) || Constants.SPAN_TYPE_MAP.containsKey(spanTypeStr)) {
- result.spanTypeStr = Constants.SPAN_TYPE_U;
- }
- result.spanTypeStr = spanTypeStr;
- if (Constants.SPAN_TYPE_MAP.containsKey(spanTypeStr)) {
- result.spanTypeName = Constants.SPAN_TYPE_MAP.get(spanTypeStr);
- ;
- } else {
- //非默认支持的类型,使用原文中的类型,不需要解析
- result.spanTypeName = result.spanTypeStr;
- }
-
- // 处理状态key-value
- String statusCodeStr = String.valueOf(result.getStatusCode());
- if (StringUtil.isBlank(statusCodeStr) || Constants.STATUS_CODE_MAP.containsKey(statusCodeStr)) {
- result.statusCodeStr = Constants.STATUS_CODE_9;
- }
- String statusCodeName = Constants.STATUS_CODE_MAP.get(statusCodeStr);
- result.statusCodeStr = statusCodeStr;
- result.statusCodeName = statusCodeName;
-
- result.applicationIdStr = result.getApplicationId();
- if (!StringUtil.isBlank(result.getViewPointId()) && result.getViewPointId().length() > 60) {
- result.viewPointIdSub = result.getViewPointId().substring(0, 30) + "..." + result.getViewPointId()
- .substring(result.getViewPointId().length() - 30);
- } else {
- result.viewPointIdSub = result.getViewPointId();
- }
-
- result.addTimeLine(result.getStartDate(), result.getCost());
- result.endDate = result.getStartDate() + result.getCost();
- return result;
- }
-
/***
* 增加时间轴信息
*
@@ -133,13 +128,6 @@ public class TraceNodeInfo extends FullSpan {
timeLineList.add(new TimeLineEntry(startDate, cost));
}
- public static TraceNodeInfo convert(byte[] requestSpanBytes, String colId)
- throws IllegalAccessException, InvocationTargetException, NoSuchMethodException,
- InvalidProtocolBufferException {
- TraceNodeInfo result = convert(requestSpanBytes);
- result.colId = colId;
- return result;
- }
/***
* 补充丢失的链路信息
@@ -151,9 +139,10 @@ public class TraceNodeInfo extends FullSpan {
TraceNodeInfo result = new TraceNodeInfo();
result.colId = colId;
if (colId.indexOf(Constants.VAL_SPLIT_CHAR) > -1) {
- result.setParentLevel(colId.substring(0, colId.lastIndexOf(Constants.VAL_SPLIT_CHAR)));
+ result.parentLevel = colId.substring(0, colId.lastIndexOf(Constants.VAL_SPLIT_CHAR));
+ } else {
+ result.parentLevel = "";
}
-
result.timeLineList.add(new TimeLineEntry());
// 其它默认值
@@ -165,11 +154,11 @@ public class TraceNodeInfo extends FullSpan {
return "TraceNodeInfo [colId=" + colId + ", endDate=" + endDate + ", timeLineList=" + timeLineList
+ ", spanTypeStr=" + spanTypeStr + ", spanTypeName=" + spanTypeName + ", statusCodeStr=" + statusCodeStr
+ ", statusCodeName=" + statusCodeName + ", applicationIdStr=" + applicationIdStr + ", viewPointIdSub="
- + viewPointIdSub + ", traceId=" + getTraceId() + ", parentLevel=" + getParentLevel() + ", levelId=" +
- getLevelId() + ", viewPointId=" + getViewPointId() + ", startDate=" + getStartDate() + ", cost="
- + getCost() + ", statusCode=" + getStatusCode() + ", exceptionStack=" + getExceptionStack()
- + ", spanType=" + getSpanType() + ", businessKey=" + getBusinessKey() + ", applicationId="
- + getApplicationId() + "]";
+ + viewPointIdSub + ", traceId=" + traceId + ", parentLevel=" + parentLevel + ", levelId=" + levelId
+ + ", viewPointId=" + viewPointId + ", startDate=" + startDate + ", cost=" + cost + ", address="
+ + address + ", statusCode=" + statusCode + ", exceptionStack=" + exceptionStack + ", spanType="
+ + spanType + ", businessKey=" + businessKey + ", processNo=" + processNo + ", applicationId="
+ + applicationId + "]";
}
public List getTimeLineList() {
@@ -196,4 +185,11 @@ public class TraceNodeInfo extends FullSpan {
this.serverExceptionStr = serverExceptionStr;
}
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public void setExceptionStack(String exceptionStack) {
+ this.exceptionStack = exceptionStack;
+ }
}
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodesResult.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodesResult.java
index 912a4660d..3a17c6856 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodesResult.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TraceNodesResult.java
@@ -8,7 +8,7 @@ import java.util.List;
* Created by xin on 16-4-13.
*/
public class TraceNodesResult {
- private boolean isOverMaxQueryNodeNumber;
+ private boolean isOverMaxQueryNodeNumber = true;
private List result;
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/TraceTreeService.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/TraceTreeService.java
index 3c6fd9ac1..cc64e2c84 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/TraceTreeService.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/TraceTreeService.java
@@ -1,5 +1,6 @@
package com.ai.cloud.skywalking.web.service.impl;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
import com.ai.cloud.skywalking.protocol.util.SpanLevelIdComparators;
import com.ai.cloud.skywalking.web.dao.inter.ITraceNodeDao;
import com.ai.cloud.skywalking.web.dto.TraceNodeInfo;
@@ -30,7 +31,9 @@ public class TraceTreeService implements ITraceTreeService {
private ITraceNodeDao traceTreeDao;
@Override
- public TraceTreeInfo queryTraceTreeByTraceId(String traceId) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException, IOException {
+ public TraceTreeInfo queryTraceTreeByTraceId(String traceId)
+ throws InvocationTargetException, NoSuchMethodException, ConvertFailedException, IllegalAccessException,
+ IOException {
TraceTreeInfo traceTreeInfo = new TraceTreeInfo(traceId);
TraceNodesResult traceNodesResult = traceTreeDao.queryTraceNodesByTraceId(traceId);
List traceNodeInfoList = traceNodesResult.getResult();
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/inter/ITraceTreeService.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/inter/ITraceTreeService.java
index 07c607db1..b3fe439c2 100644
--- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/inter/ITraceTreeService.java
+++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/inter/ITraceTreeService.java
@@ -1,5 +1,6 @@
package com.ai.cloud.skywalking.web.service.inter;
+import com.ai.cloud.skywalking.protocol.exception.ConvertFailedException;
import com.ai.cloud.skywalking.web.dto.TraceTreeInfo;
import java.io.IOException;
@@ -9,5 +10,7 @@ import java.lang.reflect.InvocationTargetException;
* Created by xin on 16-3-30.
*/
public interface ITraceTreeService {
- TraceTreeInfo queryTraceTreeByTraceId(String traceId) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException, IOException;
+ TraceTreeInfo queryTraceTreeByTraceId(String traceId)
+ throws InvocationTargetException, NoSuchMethodException, IllegalAccessException, IOException,
+ ConvertFailedException;
}
diff --git a/skywalking-webui/src/test/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandlerTest.java b/skywalking-webui/src/test/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandlerTest.java
new file mode 100644
index 000000000..288a64c29
--- /dev/null
+++ b/skywalking-webui/src/test/java/com/ai/cloud/skywalking/web/dao/impl/SpanDataHandlerTest.java
@@ -0,0 +1,77 @@
+package com.ai.cloud.skywalking.web.dao.impl;
+
+import com.ai.cloud.skywalking.protocol.RequestSpan;
+import com.ai.cloud.skywalking.protocol.proto.TraceProtocol;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.*;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Test;
+
+import static org.apache.hadoop.hbase.util.Bytes.toBytes;
+import static org.junit.Assert.*;
+
+/**
+ * Created by xin on 16/8/5.
+ */
+public class SpanDataHandlerTest {
+
+ private Configuration configuration;
+ private Connection connection;
+
+ @Test
+ public void addSpan0() throws Exception {
+ if (configuration == null) {
+ configuration = HBaseConfiguration.create();
+ configuration.set("hbase.zookeeper.quorum", "swhbaseenv");
+ configuration.set("hbase.zookeeper.property.clientPort", "2181");
+ }
+ connection = ConnectionFactory.createConnection(configuration);
+
+ Admin admin = connection.getAdmin();
+ if (!admin.tableExists(TableName.valueOf("trace-data"))){
+ HTableDescriptor descriptor = new HTableDescriptor(TableName.valueOf("trace-data"));
+ HColumnDescriptor family = new HColumnDescriptor(toBytes("call-chain"));
+ descriptor.addFamily(family);
+ admin.createTable(descriptor);
+ }
+
+ TraceProtocol.RequestSpan requestSpan = TraceProtocol.RequestSpan.newBuilder().setUserId("1")
+ .setStartDate(System.currentTimeMillis() - 10 * 1000).setViewPointId("test").setAgentId("1")
+ .setApplicationId("test").setCallType("w").setLevelId(0).setParentLevel("test").setSpanType(1)
+ .setSpanTypeDesc("test").setTraceId("test").build();
+
+
+
+
+ Put put = new Put(Bytes.toBytes(requestSpan.getTraceId()));
+ put.addColumn(Bytes.toBytes("call-chain"), Bytes.toBytes("0"), requestSpan.toByteArray());
+ for (byte b : requestSpan.toByteArray()){
+ System.out.print(b + " ");
+ }
+ Table table = connection.getTable(TableName.valueOf("trace-data"));
+ table.put(put);
+
+ Get get = new Get(requestSpan.getTraceId().getBytes());
+ Result result = table.get(get);
+ for (Cell cell : result.rawCells()){
+ byte[] bytes = CellUtil.cloneValue(cell);
+ for (byte b : bytes){
+ System.out.print(b + " ");
+ }
+ TraceProtocol.RequestSpan requestSpan1 = TraceProtocol.RequestSpan.parseFrom(cell.getValueArray());
+ }
+
+
+ }
+
+ @Test
+ public void addSpan() throws Exception {
+ TraceProtocol.RequestSpan requestSpan =
+ TraceProtocol.RequestSpan.newBuilder().setLevelId(0).setTraceId("test").setCallType("1")
+ .setParentLevel("").setApplicationId("1").setSpanType(1).setSpanTypeDesc("web").setAgentId("1")
+ .setViewPointId("tst").setStartDate(System.currentTimeMillis() - 10000).setUserId("1").build();
+ new RequestSpan(requestSpan.toByteArray());
+ }
+
+}