定义Grpc接口

This commit is contained in:
ascrutae 2016-11-11 15:08:54 +08:00
parent af3117d1c6
commit 52becff8f5
5 changed files with 48 additions and 85 deletions

View File

@ -1,42 +0,0 @@
package com.a.eye.skywalking.network;
import io.grpc.Channel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.DnsNameResolverProvider;
public class Client {
private static Client client;
private Channel channel;
private static final String DEFAULT_ADDRESS = "localhost";
private static final int DEFAULT_PORT = 34000;
private String host = DEFAULT_ADDRESS;
private int port = DEFAULT_PORT;
public static Client forAddress(String host, int port) {
if (client == null) {
client = new Client(host, port);
}
return client;
}
public static Client INSTANCE() {
return client;
}
private Client(String host, int port) {
this.host = host;
this.port = port;
}
public void start() {
ManagedChannelBuilder<?> channelBuilder =
ManagedChannelBuilder.forAddress(host, port).nameResolverFactory(new DnsNameResolverProvider())
.usePlaintext(true);
channel = channelBuilder.build();
}
}

View File

@ -1,33 +0,0 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.a.eye.skywalking.network.grpc";
import "Spans.proto";
service AckSpanSender {
rpc send (stream AckSpan) returns (SendResult) {
};
}
service RequestSpanSender {
rpc send (stream RequestSpan) returns (SendResult) {
};
}
service InputParametersSpanSender {
rpc send (stream InputParametersSpan) returns (SendResult) {
};
}
service OutputParametersSpanSender {
rpc send (stream OutputParametersSpan) returns (SendResult) {
};
}
message SendResult {
// 0 1
int32 result = 1;
}

View File

@ -0,0 +1,18 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.a.eye.skywalking.network.grpc";
import "Spans.proto";
service SpanStorageService {
rpc storageACKSpan(stream AckSpan) returns (SendResult) {
};
rpc storageRequestSpan(stream RequestSpan) returns (SendResult) {
};
}
message SendResult {
// 0 1
int32 result = 1;
}

View File

@ -25,19 +25,24 @@ message RequestSpan {
string applicationId = 9;
string userId = 10;
string bussinessKey = 11;
string agentId = 12;
string processNo = 13;
string address = 14;
}
message InputParametersSpan {
message Span{
string traceId = 1;
string traceLevelId = 2;
map<string, string> parameters = 3;
}
message OutputParametersSpan {
string traceId = 1;
string traceLevelId = 2;
string outputParameter = 3;
string levelId = 2; // parentLevelId + "." + levelId
string viewpoint = 3;
int64 starttime = 4;
int64 cost = 5;
int32 statusCode = 6;
string exceptionStack = 7;
string spanTypeDesc = 8;
string callType = 9;
uint32 spanType = 10;
string applicationId = 11;
string userId = 12;
string businessKey = 13;
string processNo = 14;
string address = 15;
}

View File

@ -0,0 +1,15 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.a.eye.skywalking.network.grpc";
import "Spans.proto";
service TraceSearchService{
rpc search(string) returns (SearchResult){};
}
message SearchResult{
repeated Span spans= 1;
}