...
1syntax = "proto3";
2
3package linkerd2.viz;
4
5import "google/protobuf/duration.proto";
6
7option go_package = "github.com/linkerd/linkerd2/viz/metrics-api/gen/viz";
8
9message Empty {}
10
11enum CheckStatus {
12 OK = 0;
13 FAIL = 1;
14 ERROR = 2;
15}
16
17message CheckResult {
18 string SubsystemName = 1;
19 string CheckDescription = 2;
20 CheckStatus Status = 3;
21 string FriendlyMessageToUser = 4;
22}
23
24message SelfCheckRequest {}
25
26message SelfCheckResponse {
27 repeated CheckResult results = 1;
28}
29
30message ListServicesRequest {
31 string namespace = 1;
32}
33message ListServicesResponse {
34 repeated Service services = 1;
35}
36message Service {
37 string name = 1;
38 string namespace = 2;
39}
40
41message ListPodsRequest {
42 ResourceSelection selector = 2;
43}
44message ListPodsResponse {
45 repeated Pod pods = 1;
46}
47
48message Pod {
49 string name = 1;
50 string podIP = 2;
51 oneof owner {
52 string deployment = 3;
53 string replica_set = 10;
54 string replication_controller = 11;
55 string stateful_set = 12;
56 string daemon_set = 13;
57 string job = 14;
58 }
59 string status = 4;
60 bool added = 5; // true if this pod has a proxy sidecar (data plane)
61 google.protobuf.Duration sinceLastReport = 6;
62 string controllerNamespace = 7; // namespace of controller this pod reports to
63 bool controlPlane = 8; // true if this pod is part of the control plane
64 google.protobuf.Duration uptime = 9; // uptime of this pod
65 bool proxyReady = 15; // true if this pod has proxy container and that one is in ready state
66 string proxyVersion = 16; // version of the proxy if present
67 string resourceVersion = 17; // resource version in the Kubernetes API
68}
69
70message HttpMethod {
71 enum Registered {
72 GET = 0;
73 POST = 1;
74 PUT = 2;
75 DELETE = 3;
76 PATCH = 4;
77 OPTIONS = 5;
78 CONNECT = 6;
79 HEAD = 7;
80 TRACE = 8;
81 }
82
83 oneof type {
84 Registered registered = 1;
85 string unregistered = 2;
86 }
87}
88
89message Scheme {
90 enum Registered {
91 HTTP = 0;
92 HTTPS = 1;
93 }
94
95 oneof type {
96 Registered registered = 1;
97 string unregistered = 2;
98 }
99}
100
101message Headers {
102 message Header {
103 // The name of a header in a request.
104 string name = 1;
105 // The value of a header in a request. If the value consists entirely of
106 // UTF-8 encodings, `value` will be set; otherwise a binary value is
107 // assumed and `value_bin` will be set.
108 oneof value {
109 string value_str = 2;
110 bytes value_bin = 3;
111 }
112 }
113
114 repeated Header headers = 1;
115}
116
117message Eos {
118 oneof end {
119 uint32 grpc_status_code = 1;
120 uint32 reset_error_code = 2;
121 }
122}
123
124message ApiError {
125 string error = 1;
126}
127
128message PodErrors {
129 repeated PodError errors = 1;
130
131 message PodError {
132 oneof error {
133 ContainerError container = 1;
134 }
135
136 // To report init-container and container failures
137 message ContainerError {
138 string message = 1;
139 string container = 2;
140 string image = 3;
141 string reason = 4;
142 }
143 }
144}
145
146message Resource {
147 // The namespace the resource is in.
148 //
149 // If empty, indicates all namespaces should be considered.
150 string namespace = 1;
151
152 // The type of resource.
153 //
154 // This can be:
155 // - "all" -- includes all Kubernetes resource types only
156 // - "authority" -- a special resource type derived from request `:authority` values
157 // - Otherwise, the resource type may be any Kubernetes resource (e.g. "namespace", "deployment").
158 string type = 2;
159
160 // An optional resource name.
161 string name = 3;
162}
163
164message ResourceSelection {
165 // Identifies a Kubernetes resource.
166 Resource resource = 1;
167
168 // A string-formatted Kubernetes label selector as passed to `kubectl get
169 // --selector`.
170 //
171 // XXX in the future this may be superseded by a data structure that more
172 // richly describes a parsed label selector.
173 string label_selector = 2;
174}
175
176message ResourceError {
177 Resource resource = 1;
178 string error = 2;
179}
180
181message StatSummaryRequest {
182 ResourceSelection selector = 1;
183 string time_window = 2;
184
185 oneof outbound {
186 Empty none = 3;
187 Resource to_resource = 4;
188 Resource from_resource = 5;
189 }
190
191 bool skip_stats = 6; // true if we want to skip stats from Prometheus
192 bool tcp_stats = 7;
193}
194
195message StatSummaryResponse {
196 oneof response {
197 Ok ok = 1;
198 ResourceError error = 2;
199 }
200
201 message Ok {
202 repeated StatTable stat_tables = 1;
203 }
204}
205
206message AuthzRequest {
207 Resource resource = 1;
208 string time_window = 2;
209}
210
211message AuthzResponse {
212 oneof response {
213 Ok ok = 1;
214 ResourceError error = 2;
215 }
216
217 message Ok {
218 StatTable stat_table = 1;
219 }
220}
221
222message BasicStats {
223 uint64 success_count = 1;
224 uint64 failure_count = 2;
225 uint64 latency_ms_p50 = 3;
226 uint64 latency_ms_p95 = 4;
227 uint64 latency_ms_p99 = 5;
228 uint64 actual_success_count = 6;
229 uint64 actual_failure_count = 7;
230}
231
232message TcpStats {
233 // number of currently open connections
234 uint64 open_connections = 1;
235 // total count of bytes read from peers
236 uint64 read_bytes_total = 2;
237 // total count of bytes written to peers
238 uint64 write_bytes_total = 3;
239}
240
241message TrafficSplitStats {
242 string apex = 2;
243 string leaf = 3;
244 string weight = 4;
245}
246
247message ServerStats {
248 uint64 allowed_count = 1;
249 uint64 denied_count = 2;
250 Resource srv = 3;
251 Resource route = 4;
252 Resource authz = 5;
253}
254
255message StatTable {
256 oneof table {
257 PodGroup pod_group = 1;
258 }
259
260 message PodGroup {
261 repeated Row rows = 1;
262
263 message Row {
264 Resource resource = 1;
265 string time_window = 2;
266
267 // pod status on Kubernetes
268 string status = 9;
269 // number of pending or running pods in this resource that have linkerd injected
270 uint64 meshed_pod_count = 3;
271 // number of pending or running pods in this resource
272 uint64 running_pod_count = 4;
273 // number of pods in this resource that have Phase PodFailed
274 uint64 failed_pod_count = 6;
275
276 BasicStats stats = 5;
277 TcpStats tcp_stats = 8;
278 TrafficSplitStats ts_stats = 10;
279 ServerStats srv_stats = 11;
280
281 // Stores a set of errors for each pod name. If a pod has no errors, it may be omitted.
282 map<string, PodErrors> errors_by_pod = 7;
283 }
284 }
285}
286
287message EdgesRequest {
288 ResourceSelection selector = 1;
289}
290
291message EdgesResponse {
292 oneof response {
293 Ok ok = 1;
294 ResourceError error = 2;
295 }
296
297 message Ok {
298 repeated Edge edges = 1;
299 }
300}
301
302message Edge {
303 Resource src = 1;
304 Resource dst = 2;
305 string client_id = 3;
306 string server_id = 4;
307 string no_identity_msg = 5;
308}
309
310message TopRoutesRequest {
311 ResourceSelection selector = 1;
312 string time_window = 2;
313
314 oneof outbound {
315 Empty none = 3;
316 Resource to_resource = 7;
317 }
318}
319
320message TopRoutesResponse {
321 oneof response {
322 ResourceError error = 2;
323 Ok ok = 3;
324 }
325
326 message Ok {
327 repeated RouteTable routes = 1;
328 }
329}
330
331message RouteTable {
332 repeated Row rows = 1;
333 string resource = 2;
334
335 message Row {
336 string route = 1;
337 string time_window = 2;
338 string authority = 6;
339
340 BasicStats stats = 5;
341 }
342}
343
344
345message GatewaysTable {
346 repeated Row rows = 1;
347
348 message Row {
349 string namespace = 1;
350 string name = 2;
351 string cluster_name = 3;
352 uint64 paired_services = 4;
353 bool alive = 5;
354 uint64 latency_ms_p50 = 6;
355 uint64 latency_ms_p95 = 7;
356 uint64 latency_ms_p99 = 8;
357 }
358}
359
360message GatewaysRequest {
361 string remote_cluster_name = 1;
362 string gateway_namespace = 2;
363 string time_window = 3;
364}
365
366message GatewaysResponse {
367 oneof response {
368 Ok ok = 1;
369 ResourceError error = 2;
370 }
371
372 message Ok {
373 GatewaysTable gateways_table = 1;
374 }
375}
376
377service Api {
378 rpc StatSummary(StatSummaryRequest) returns (StatSummaryResponse) {}
379
380 rpc Edges(EdgesRequest) returns (EdgesResponse) {}
381
382 rpc Gateways(GatewaysRequest) returns (GatewaysResponse) {}
383
384 rpc TopRoutes(TopRoutesRequest) returns (TopRoutesResponse) {}
385
386 rpc ListPods(ListPodsRequest) returns (ListPodsResponse) {}
387
388 rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {}
389
390 rpc SelfCheck(SelfCheckRequest) returns (SelfCheckResponse) {}
391
392 rpc Authz(AuthzRequest) returns (AuthzResponse) {}
393}
View as plain text