提交 52becff8 编写于 作者: A ascrutae

定义Grpc接口

上级 af3117d1
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();
}
}
......@@ -5,25 +5,10 @@ option java_package = "com.a.eye.skywalking.network.grpc";
import "Spans.proto";
service AckSpanSender {
rpc send (stream AckSpan) returns (SendResult) {
service SpanStorageService {
rpc storageACKSpan(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) {
rpc storageRequestSpan(stream RequestSpan) returns (SendResult) {
};
}
......
......@@ -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;
}
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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册