-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathdiagnosticspb.proto
92 lines (79 loc) · 1.96 KB
/
diagnosticspb.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
syntax = "proto3";
package diagnosticspb;
import "gogoproto/gogo.proto";
import "rustproto.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;
option java_package = "org.tikv.kvproto";
// Diagnostics service for TiDB cluster components.
service Diagnostics {
// Searchs log in the target node
rpc search_log(SearchLogRequest) returns (stream SearchLogResponse) {};
// Retrieves server info in the target node
rpc server_info(ServerInfoRequest) returns (ServerInfoResponse) {};
}
enum LogLevel {
UNKNOWN = 0;
Debug = 1;
Info = 2;
Warn = 3;
Trace = 4;
Critical = 5;
Error = 6;
}
message SearchLogRequest {
enum Target {
Normal = 0;
Slow = 1;
}
int64 start_time = 1;
int64 end_time = 2;
repeated LogLevel levels = 3;
// We use a string array to represent multiple CNF pattern sceniaor like:
// SELECT * FROM t WHERE c LIKE '%s%' and c REGEXP '.*a.*' because
// Golang and Rust don't support perl-like (?=re1)(?=re2)
repeated string patterns = 4;
Target target = 5;
}
message SearchLogResponse {
repeated LogMessage messages = 1;
}
message LogMessage {
int64 time = 1;
LogLevel level = 2;
string message = 3;
}
enum ServerInfoType {
All = 0;
HardwareInfo = 1;
SystemInfo = 2;
LoadInfo = 3;
}
message ServerInfoRequest {
ServerInfoType tp = 1;
}
message ServerInfoPair {
string key = 1;
string value = 2;
}
message ServerInfoItem {
// cpu, memory, disk, network ...
string tp = 1;
// eg. network: lo1/eth0, cpu: core1/core2, disk: sda1/sda2
string name = 2;
// all key-value pairs for specified item, e.g:
// ServerInfoItem {
// tp = "network"
// name = "eth0"
// paris = [
// ServerInfoPair { key = "readbytes", value = "4k"},
// ServerInfoPair { key = "writebytes", value = "1k"},
// ]
// }
repeated ServerInfoPair pairs = 3;
}
message ServerInfoResponse {
repeated ServerInfoItem items = 1;
}