forked from intelsdi-x/snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.proto
206 lines (174 loc) · 5.1 KB
/
plugin.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package rpc;
service Collector {
rpc CollectMetrics(MetricsArg) returns (MetricsReply) {}
rpc GetMetricTypes(GetMetricTypesArg) returns (MetricsReply) {}
rpc Ping(Empty) returns (ErrReply) {}
rpc Kill(KillArg) returns (ErrReply) {}
rpc GetConfigPolicy(Empty) returns (GetConfigPolicyReply) {}
}
service Processor {
rpc Process(PubProcArg) returns (MetricsReply) {}
rpc Ping(Empty) returns (ErrReply) {}
rpc Kill(KillArg) returns (ErrReply) {}
rpc GetConfigPolicy(Empty) returns (GetConfigPolicyReply) {}
}
service Publisher {
rpc Publish(PubProcArg) returns (ErrReply) {}
rpc Ping(Empty) returns (ErrReply) {}
rpc Kill(KillArg) returns (ErrReply) {}
rpc GetConfigPolicy(Empty) returns (GetConfigPolicyReply) {}
}
service StreamCollector {
rpc StreamMetrics(stream CollectArg) returns (stream CollectReply) {}
rpc GetMetricTypes(GetMetricTypesArg) returns (MetricsReply) {}
rpc Ping(Empty) returns (ErrReply) {}
rpc Kill(KillArg) returns (ErrReply) {}
rpc GetConfigPolicy(Empty) returns (GetConfigPolicyReply) {}
}
// Request that can be passed a stream collector
message CollectArg{
// Request these metrics to be collected on the plugins schedule
MetricsArg Metrics_Arg = 1;
// Set Maximum collection duration in ns. The events will be buffered
// until the max duration is reached and/or the maxMetric buffer amount is
// reached. 0 means the events will be sent immediately.
int64 MaxCollectDuration = 2;
// Set max number of metrics to buffer before forcing sending. Events
// are sent as soon as MaxMetricsBuffer is reached or MaxCollectDuration
// is exceeded, whichever happens first. If MaxMetricsBuffer is 0 metrics
// will be sent immediately. If MaxCollectDuration is set to 0 then
// maxMetricsBuffer will not be used as metrics will be sent immediately.
int64 MaxMetricsBuffer = 3;
// Blob of domain specific info
bytes Other = 4;
}
// Replies that can be sent from a stream collector
message CollectReply{
// Reply with metrics
MetricsReply Metrics_Reply = 1;
ErrReply Error = 2;
}
message Empty{}
message ErrReply {
string error = 1;
}
message Time{
int64 sec = 1;
int64 nsec = 2;
}
message NamespaceElement {
string Value = 1;
string Description = 2;
string Name = 3;
}
message PubProcArg {
repeated Metric Metrics = 1;
ConfigMap Config = 2;
}
// core.Metric
message Metric {
repeated NamespaceElement Namespace = 1;
int64 Version = 2;
ConfigMap Config = 3;
Time LastAdvertisedTime = 4;
map<string, string> Tags = 5;
Time Timestamp = 6;
string Unit = 7;
string Description = 8;
oneof data {
string string_data = 9;
float float32_data = 10;
double float64_data = 11;
int32 int32_data = 12;
int64 int64_data = 13;
bytes bytes_data = 14;
bool bool_data = 15;
uint32 uint32_data = 16;
uint64 uint64_data = 17;
}
}
message ConfigMap {
map<string, int64> IntMap = 1;
map<string, string> StringMap = 2;
// double is float64
map<string, double> FloatMap = 3;
map<string, bool> BoolMap = 4;
}
message KillArg {
string Reason = 1;
}
message GetConfigPolicyReply {
string error = 1;
map<string, BoolPolicy> bool_policy = 2;
map<string, FloatPolicy> float_policy = 3;
map<string, IntegerPolicy> integer_policy = 4;
map<string, StringPolicy> string_policy = 5;
}
message BoolRule {
bool required = 1;
bool default = 2;
bool has_default = 3;
}
message BoolPolicy {
map<string, BoolRule> rules = 1;
repeated string key = 2;
}
message FloatRule {
bool required = 1;
double minimum = 2;
double maximum = 3;
double default = 4;
bool has_default = 5;
bool has_min = 6;
bool has_max = 7;
}
message FloatPolicy {
map<string, FloatRule> rules = 1;
repeated string key = 2;
}
message IntegerRule {
bool required = 1;
int64 minimum = 2;
int64 maximum = 3;
int64 default = 4;
bool has_default = 5;
bool has_min = 6;
bool has_max = 7;
}
message IntegerPolicy {
map<string, IntegerRule> rules = 1;
repeated string key = 2;
}
message StringRule {
bool required = 1;
string default = 2;
bool has_default = 3;
}
message StringPolicy {
map<string, StringRule> rules = 1;
repeated string key = 2;
}
message MetricsArg {
repeated Metric metrics = 1;
}
message MetricsReply {
repeated Metric metrics = 1;
string error = 2;
}
message GetMetricTypesArg {
ConfigMap config = 1;
}