定义Grpc接口
This commit is contained in:
parent
af3117d1c6
commit
52becff8f5
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
Loading…
Reference in New Issue