提交 ee003f8e 编写于 作者: A ascrutae

初始化skywalking-network工程

上级 ac832222
<?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/xsd/maven-4.0.0.xsd">
<groupId>com.a.eye</groupId>
<version>2.0-2016</version>
<modelVersion>4.0.0</modelVersion>
<artifactId>skywalking-network</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Google dependence-->
<shade.com.google.source>com.google</shade.com.google.source>
<shade.com.google.target>com.a.eye.skywalking.network.dependencies.com.google</shade.com.google.target>
<!-- GRPC -->
<shade.io.grpc.source>io.grpc</shade.io.grpc.source>
<shade.io.grpc.target>com.a.eye.skywalking.network.dependencies.io.grpc</shade.io.grpc.target>
<!--netty -->
<shade.io.netty.source>io.netty</shade.io.netty.source>
<shade.io.netty.target>com.a.eye.skywalking.network.dependencies.io.netty</shade.io.netty.target>
</properties>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.1.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.0.2:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<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.source}</pattern>
<shadedPattern>${shade.com.google.target}</shadedPattern>
</relocation>
<relocation>
<pattern>${shade.io.grpc.source}</pattern>
<shadedPattern>${shade.io.grpc.target}</shadedPattern>
</relocation>
<relocation>
<pattern>${shade.io.netty.source}</pattern>
<shadedPattern>${shade.io.netty.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>
</plugins>
</build>
</project>
package com.a.eye.skywalking.network;
import com.a.eye.skywalking.network.grpc.SendResult;
import com.a.eye.skywalking.network.grpc.SendingSpans;
import com.a.eye.skywalking.network.grpc.SpanSenderGrpc;
import io.grpc.stub.StreamObserver;
/**
* Created by xin on 2016/10/25.
*/
public class GrpcSpanSender extends SpanSenderGrpc.SpanSenderImplBase {
@Override
public StreamObserver<SendingSpans> send(StreamObserver<SendResult> responseObserver) {
//TODO
return super.send(responseObserver);
}
}
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.a.eye.skywalking.network.grpc";
import "Spans.proto";
service SpanSender {
rpc send (stream SendingSpans) returns (SendResult) {
};
}
message SendResult {
// 0 成功 1 失败
int32 result = 1;
}
message SendingSpans {
repeated AckSpan ackSpans = 1;
repeated RequestSpan requestSpans = 2;
repeated InputParametersSpan inputParamSpans = 3;
repeated OutputParametersSpan outputParamSpans = 4;
}
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.a.eye.skywalking.network.grpc";
message AckSpan {
string traceId = 1;
string parentLevel = 2;
int32 levelId = 3;
int64 cost = 4;
int32 statusCode = 5;
string exceptionStack = 6;
string viewpointId = 7;
}
message RequestSpan {
string traceId = 1;
string parentLevel = 2;
int32 levelId = 3;
string viewPointId = 4;
int64 startDate = 5;
string spanTypeDesc = 6;
string callType = 7;
uint32 spanType = 8;
string applicationId = 9;
string userId = 10;
string bussinessKey = 11;
string agentId = 12;
string processNo = 13;
string address = 14;
}
message InputParametersSpan {
string traceId = 1;
string traceLevelId = 2;
map<string, string> parameters = 3;
}
message OutputParametersSpan {
string traceId = 1;
string traceLevelId = 2;
string outputParameter = 3;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册