提交新版本功能
This commit is contained in:
parent
b8577d4a48
commit
d606174e79
|
|
@ -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
|
||||
|
|
|
|||
5
pom.xml
5
pom.xml
|
|
@ -32,6 +32,11 @@
|
|||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-protocol</artifactId>
|
||||
<version>1.0-Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -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<String> loadHasBeenMergeChainIds(String treeId) throws IOException {
|
||||
List<String> result = new ArrayList<String>();
|
||||
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<String> hasBeenMergedCIds = new Gson().fromJson(Bytes.toString(cell.getValueArray(),
|
||||
cell.getValueOffset(), cell.getValueLength()),
|
||||
new TypeToken<List<String>>() {
|
||||
}.getType());
|
||||
List<String> hasBeenMergedCIds = new Gson()
|
||||
.fromJson(Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()),
|
||||
new TypeToken<List<String>>() {
|
||||
}.getType());
|
||||
result.addAll(hasBeenMergedCIds);
|
||||
}
|
||||
|
||||
|
|
@ -198,12 +209,14 @@ public class HBaseUtil {
|
|||
}
|
||||
|
||||
public static void batchSaveMinSummaryResult(List<Put> 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<Put> 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<Put> 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<Put> 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<FullSpan> fetchTraceSpansFromHBase(Result value) throws InvalidProtocolBufferException {
|
||||
public static List<FullSpan> fetchTraceSpansFromHBase(Result value) throws ConvertFailedException {
|
||||
List<FullSpan> spanList = new ArrayList<FullSpan>();
|
||||
Map<String, AckSpan> ackSpans = new HashMap<String, AckSpan>();
|
||||
for (Cell cell : value.rawCells()) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
<artifactId>skywalking-collector</artifactId>
|
||||
|
||||
<modules>
|
||||
<module>skywalking-protocol</module>
|
||||
<module>skywalking-api</module>
|
||||
<module>skywalking-sdk-plugin</module>
|
||||
<module>skywalking-log</module>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
<shade.net.bytebuddy.target>com.ai.cloud.skywalking.api.dependencies.net.bytebuddy</shade.net.bytebuddy.target>
|
||||
<shade.io.netty.source>io.netty</shade.io.netty.source>
|
||||
<shade.io.netty.target>com.ai.cloud.skywalking.api.dependencies.io.netty</shade.io.netty.target>
|
||||
<shade.com.google.protobuf.source>com.google.protobuf</shade.com.google.protobuf.source>
|
||||
<shade.com.google.protobuf.target>com.ai.cloud.skywalking.api.dependencies.google.protobuf</shade.com.google.protobuf.target>
|
||||
<shade.com.google.gson.source>com.google.gson</shade.com.google.gson.source>
|
||||
<shade.com.google.gson.target>com.ai.cloud.skywalking.api.dependencies.com.google.gson</shade.com.google.gson.target>
|
||||
</properties>
|
||||
|
|
@ -91,10 +89,6 @@
|
|||
<pattern>${shade.io.netty.source}</pattern>
|
||||
<shadedPattern>${shade.io.netty.target}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>${shade.com.google.protobuf.source}</pattern>
|
||||
<shadedPattern>${shade.com.google.protobuf.target}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>${shade.com.google.gson.source}</pattern>
|
||||
<shadedPattern>${shade.com.google.gson.target}</shadedPattern>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-collector</artifactId>
|
||||
<version>1.0-Final</version>
|
||||
</parent>
|
||||
|
||||
<name>skywalking-protocol</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<artifactId>skywalking-protocol</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.basedir}/src/main/gen-java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<!--<plugin>-->
|
||||
<!--<artifactId>maven-antrun-plugin</artifactId>-->
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<id>compile-protoc</id>-->
|
||||
<!--<phase>generate-sources</phase>-->
|
||||
<!--<configuration>-->
|
||||
<!--<tasks>-->
|
||||
<!--<mkdir dir="src/main/gen-java" />-->
|
||||
<!--<path id="proto.path">-->
|
||||
<!--<fileset dir="src/main/proto">-->
|
||||
<!--<include name="*.proto" />-->
|
||||
<!--</fileset>-->
|
||||
<!--</path>-->
|
||||
<!--<pathconvert pathsep=" " property="proto.files"-->
|
||||
<!--refid="proto.path" />-->
|
||||
|
||||
<!--<exec executable="protoc">-->
|
||||
<!--<arg value="--java_out=src/main/gen-java" />-->
|
||||
<!--<arg value="-I${project.basedir}/src/main/proto" />-->
|
||||
<!--<arg line="${proto.files}" />-->
|
||||
<!--</exec>-->
|
||||
<!--</tasks>-->
|
||||
<!--<sourceRoot>src/main/gen-java</sourceRoot>-->
|
||||
<!--</configuration>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>run</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<!--</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ public class JDBCDriverInterceptor implements InstanceMethodsAroundInterceptor {
|
|||
@Override
|
||||
public void beforeMethod(EnhancedClassInstanceContext context, InstanceMethodInvokeContext interceptorContext,
|
||||
MethodInterceptResult result) {
|
||||
System.out.println("Data/////");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-protocol</artifactId>
|
||||
<name>skywalking-protocol</name>
|
||||
<version>1.0-Final</version>
|
||||
<url>http://maven.apache.org</url>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<createSourcesJar>true</createSourcesJar>
|
||||
<shadeSourcesContent>true</shadeSourcesContent>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>${shade.com.google.protobuf.source}</pattern>
|
||||
<shadedPattern>${shade.com.google.protobuf.target}</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.basedir}/src/main/gen-java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<shade.com.google.protobuf.source>com.google.protobuf</shade.com.google.protobuf.source>
|
||||
<shade.com.google.protobuf.target>com.ai.cloud.skywalking.protocol.dependencies.com.google.protobuf</shade.com.google.protobuf.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<version>1.0-Final</version>
|
||||
|
||||
<name>skywalking-protocol</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<artifactId>skywalking-protocol</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<shade.com.google.protobuf.source>com.google.protobuf</shade.com.google.protobuf.source>
|
||||
<shade.com.google.protobuf.target>com.ai.cloud.skywalking.protocol.dependencies.com.google.protobuf</shade.com.google.protobuf.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<createSourcesJar>true</createSourcesJar>
|
||||
<shadeSourcesContent>true</shadeSourcesContent>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>${shade.com.google.protobuf.source}</pattern>
|
||||
<shadedPattern>${shade.com.google.protobuf.target}</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.basedir}/src/main/gen-java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!-- 源码插件 -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<!-- 发布时自动将源码同时发布的配置 -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<!--<plugin>-->
|
||||
<!--<artifactId>maven-antrun-plugin</artifactId>-->
|
||||
<!--<executions>-->
|
||||
<!--<execution>-->
|
||||
<!--<id>compile-protoc</id>-->
|
||||
<!--<phase>generate-sources</phase>-->
|
||||
<!--<configuration>-->
|
||||
<!--<tasks>-->
|
||||
<!--<mkdir dir="src/main/gen-java" />-->
|
||||
<!--<path id="proto.path">-->
|
||||
<!--<fileset dir="src/main/proto">-->
|
||||
<!--<include name="*.proto" />-->
|
||||
<!--</fileset>-->
|
||||
<!--</path>-->
|
||||
<!--<pathconvert pathsep=" " property="proto.files"-->
|
||||
<!--refid="proto.path" />-->
|
||||
|
||||
<!--<exec executable="protoc">-->
|
||||
<!--<arg value="--java_out=src/main/gen-java" />-->
|
||||
<!--<arg value="-I${project.basedir}/src/main/proto" />-->
|
||||
<!--<arg line="${proto.files}" />-->
|
||||
<!--</exec>-->
|
||||
<!--</tasks>-->
|
||||
<!--<sourceRoot>src/main/gen-java</sourceRoot>-->
|
||||
<!--</configuration>-->
|
||||
<!--<goals>-->
|
||||
<!--<goal>run</goal>-->
|
||||
<!--</goals>-->
|
||||
<!--</execution>-->
|
||||
<!--</executions>-->
|
||||
<!--</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray-wu-sheng-sky-walking-repository</id>
|
||||
<name>wu-sheng-sky-walking-repository</name>
|
||||
<url>https://api.bintray.com/maven/wu-sheng/skywalking/com.ai.cloud.skywalking-protocol/;publish=1</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
@ -1540,6 +1540,34 @@ public final class TraceProtocol {
|
|||
|
||||
java.lang.String getParametersOrThrow(
|
||||
java.lang.String key);
|
||||
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
boolean hasProcessNo();
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
java.lang.String getProcessNo();
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getProcessNoBytes();
|
||||
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
boolean hasAddress();
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
java.lang.String getAddress();
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
public boolean hasProcessNo() {
|
||||
return ((bitField0_ & 0x00001000) == 0x00001000);
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
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_;
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
public boolean hasAddress() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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_ = "";
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
public boolean hasProcessNo() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
public Builder setProcessNo(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00002000;
|
||||
processNo_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
public Builder clearProcessNo() {
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
processNo_ = getDefaultInstance().getProcessNo();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>required string processNo = 14;</code>
|
||||
*/
|
||||
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_ = "";
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
public boolean hasAddress() {
|
||||
return ((bitField0_ & 0x00004000) == 0x00004000);
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
public Builder setAddress(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
address_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
public Builder clearAddress() {
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
address_ = getDefaultInstance().getAddress();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>required string address = 15;</code>
|
||||
*/
|
||||
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
|
||||
|
|
@ -175,7 +175,6 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
return ackSpan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ public class BufferFileEOFProtocol extends AbstractDataSerializable {
|
|||
return new BufferFileEOFProtocol();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -85,6 +85,17 @@ public class RequestSpan extends AbstractDataSerializable {
|
|||
*/
|
||||
private String agentId = "";
|
||||
|
||||
/**
|
||||
* 节点调用的所在进程号
|
||||
*/
|
||||
protected String processNo = "";
|
||||
|
||||
/**
|
||||
* 节点调用的发生机器描述<br/>
|
||||
* 包含机器名 + 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<String, String> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -34,4 +34,6 @@ public enum SpanType {
|
|||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -26,4 +26,6 @@ message RequestSpan {
|
|||
optional string bussinessKey = 11;
|
||||
required string agentId = 12;
|
||||
map<string,string> parameters = 13;
|
||||
required string processNo = 14;
|
||||
required string address = 15;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
com.ai.cloud.skywalking.protocol.AckSpan
|
||||
com.ai.cloud.skywalking.protocol.RequestSpan
|
||||
com.ai.cloud.skywalking.protocol.BufferFileEOFProtocol
|
||||
|
|
@ -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
|
||||
|
|
@ -56,11 +56,6 @@
|
|||
<artifactId>gson</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
@ -127,7 +122,6 @@
|
|||
<exclude>*.properties</exclude>
|
||||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
<finalName>sky-walking-server</finalName>
|
||||
<outputDirectory>${project.build.directory}/installer/lib</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
|||
|
|
@ -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<String> 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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<AbstractDataSerializable> serializedObjects) {
|
||||
doAlarm(serializedObjects);
|
||||
//doAlarm(serializedObjects);
|
||||
doSaveHBase(connection, serializedObjects);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() + "";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration>
|
||||
<appender name="rollingFile"
|
||||
class="org.apache.log4j.RollingFileAppender">
|
||||
<param name="File" value="../log/skywalking-server-log4j.log"/>
|
||||
<param name="ImmediateFlush" value="true"/>
|
||||
<param name="Threshold" value="INFO"></param>
|
||||
<param name="Append" value="true"></param>
|
||||
<param name="MaxFileSize" value="10240KB"></param>
|
||||
<param name="MaxBackupIndex" value="10"></param>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %x - %m%n"></param>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<priority value="INFO" />
|
||||
<appender-ref ref="rollingFile" />
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
|
|
@ -1,26 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="DEBUG">
|
||||
<Properties>
|
||||
<Property name="log-path">../</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<RollingFile name="RollingFile" fileName="${log-path}/skywalking-server-log4j2.log"
|
||||
filePattern="${log-path}/skywalking-server-log4j2-%d{yyyy-MM-dd}-%i.log" >
|
||||
<PatternLayout>
|
||||
<pattern>%d - %c -%-4r [%t] %-5p %x - %m%n</pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="102400KB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="30"/>
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="root" level="INFO" additivity="false">
|
||||
<appender-ref ref="RollingFile" level="INFO"/>
|
||||
</Logger>
|
||||
<Root level="INFO" additivity="false">
|
||||
<AppenderRef ref="RollingFile"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
<Configuration status="debug">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d - %c -%-4r [%t] %-5p %x - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -112,11 +112,30 @@
|
|||
<artifactId>gson</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -127,30 +127,4 @@ public class SearchController extends BaseController {
|
|||
}
|
||||
return jsonObject.toJSONString();
|
||||
}
|
||||
|
||||
private List<BreviaryChainTree> generateCallChainTree() {
|
||||
List<BreviaryChainTree> acronymousChainTreeWithGuessNodes = new ArrayList<BreviaryChainTree>();
|
||||
BreviaryChainTree chainTree = new BreviaryChainTree("test");
|
||||
chainTree.setEntranceViewpoint("test");
|
||||
chainTree.setTreeId("test tree id");
|
||||
List<BreviaryChainNode> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String, RequestSpan> levelIdToRequestSpans;
|
||||
private Map<String, AckSpan> levelIdToAckSpans;
|
||||
|
||||
public SpanDataHandler() {
|
||||
levelIdToRequestSpans = new HashMap<String, RequestSpan>();
|
||||
levelIdToAckSpans = new HashMap<String, AckSpan>();
|
||||
}
|
||||
|
||||
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<String, TraceNodeInfo> merge() {
|
||||
Map<String,TraceNodeInfo> traceNodeInfos = new HashMap<String,TraceNodeInfo>();
|
||||
for (Map.Entry<String, RequestSpan> entry : levelIdToRequestSpans.entrySet()){
|
||||
TraceNodeInfo traceNodeInfo = new TraceNodeInfo(entry.getValue(), levelIdToAckSpans.get(entry.getKey()));
|
||||
traceNodeInfos.put(entry.getKey(),traceNodeInfo);
|
||||
}
|
||||
|
||||
return traceNodeInfos;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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<String, TraceNodeInfo> traceLogMap = new HashMap<String, TraceNodeInfo>();
|
||||
Map<String, TraceNodeInfo> rpcMap = new HashMap<String, TraceNodeInfo>();
|
||||
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<String, TraceNodeInfo> 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<TraceNodeInfo> 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<String, TraceNodeInfo> traceLogMap = new HashMap<String, TraceNodeInfo>();
|
||||
Map<String, TraceNodeInfo> rpcMap = new HashMap<String, TraceNodeInfo>();
|
||||
SpanDataHandler spanDataHandler = new SpanDataHandler();
|
||||
for (String node : NODES) {
|
||||
Cell cell = r.getColumnLatestCell("call-chain".getBytes(), node.getBytes());
|
||||
spanDataHandler.addSpan(cell);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, TraceNodeInfo> entry : spanDataHandler.merge().entrySet()){
|
||||
SortUtil.addCurNodeTreeMapKey(traceLogMap, entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
computeRPCInfo(rpcMap, traceLogMap);
|
||||
return traceLogMap.values();
|
||||
}
|
||||
|
||||
private void computeRPCInfo(Map<String, TraceNodeInfo> rpcMap, Map<String, TraceNodeInfo> traceLogMap) {
|
||||
// 合并处理
|
||||
if (rpcMap.size() > 0) {
|
||||
for (Map.Entry<String, TraceNodeInfo> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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<TraceNodeInfo> queryEntranceNodeByTraceId(String traceId) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException;
|
||||
Collection<TraceNodeInfo> queryEntranceNodeByTraceId(String traceId)
|
||||
throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException,
|
||||
ConvertFailedException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<TimeLineEntry> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<TraceNodeInfo> result;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<TraceNodeInfo> traceNodeInfoList = traceNodesResult.getResult();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue