增加protobuf的支持和协议,并配置shade。转换包名到:com.ai.cloud.skywalking.api.dependencies.google.protobuf
This commit is contained in:
parent
5b2b2e55aa
commit
0b5a156a3f
|
|
@ -21,6 +21,8 @@
|
|||
<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>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -82,6 +84,10 @@
|
|||
<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>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>2.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
@ -28,6 +34,25 @@
|
|||
|
||||
<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>
|
||||
|
|
@ -51,6 +76,36 @@
|
|||
</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>
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,6 +2,9 @@ package com.ai.cloud.skywalking.protocol;
|
|||
|
||||
import com.ai.cloud.skywalking.protocol.common.AbstractDataSerializable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by wusheng on 16/7/4.
|
||||
*/
|
||||
|
|
@ -19,11 +22,11 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
* 当前调用链的本机描述<br/>
|
||||
* 如当前序号为:0.1.0时,levelId=0
|
||||
*/
|
||||
private int levelId = 0;
|
||||
private int levelId = 0;
|
||||
/**
|
||||
* 节点调用花费时间
|
||||
*/
|
||||
private long cost = 0L;
|
||||
private long cost = 0L;
|
||||
/**
|
||||
* 节点调用的状态<br/>
|
||||
* 0:成功<br/>
|
||||
|
|
@ -37,6 +40,7 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
*/
|
||||
private String exceptionStack;
|
||||
|
||||
|
||||
public AckSpan(Span spanData) {
|
||||
this.traceId = spanData.getTraceId();
|
||||
this.parentLevel = spanData.getParentLevel();
|
||||
|
|
@ -46,6 +50,11 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
this.exceptionStack = spanData.getExceptionStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* 埋点入参列表,补充时触发
|
||||
*/
|
||||
private Map<String, String> paramters = new HashMap<String, String>();
|
||||
|
||||
public String getTraceId() {
|
||||
return traceId;
|
||||
}
|
||||
|
|
@ -94,6 +103,14 @@ public class AckSpan extends AbstractDataSerializable {
|
|||
this.exceptionStack = exceptionStack;
|
||||
}
|
||||
|
||||
public Map<String, String> getParamters() {
|
||||
return paramters;
|
||||
}
|
||||
|
||||
public void setParamters(Map<String, String> paramters) {
|
||||
this.paramters = paramters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataType() {
|
||||
return 2;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ public class RequestSpan extends AbstractDataSerializable {
|
|||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 埋点入参列表
|
||||
*/
|
||||
private Map<String, String> paramters = new HashMap<String, String>();
|
||||
|
||||
public RequestSpan(Span spanData) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
syntax="proto2";
|
||||
|
||||
option java_package = "com.ai.cloud.skywalking.protocol.proto";
|
||||
|
||||
message AckSpan{
|
||||
required string traceId = 1;
|
||||
optional string parentLevel = 2;
|
||||
optional int32 levelId = 3;
|
||||
required int64 cost = 4;
|
||||
required int32 statusCode = 5;
|
||||
optional string exceptionStack = 6;
|
||||
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-test-api</artifactId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue