Debian Codegraph @

proto/types/v1/logquery.proto

raw
1 syntax = "proto3";
2
3 package types.v1;
4
5 import "google/protobuf/timestamp.proto";
6 import "types/v1/types.proto";
7
8 option go_package = "types/v1;typesv1";
9
10 message LogQuery {
11 Timerange timerange = 1;
12 Context context = 2;
13 Statements query = 3;
14 }
15
16 message Timerange {
17 Expr from = 1;
18 optional Expr to = 2;
19 }
20
21 message Context {
22 optional Expr machine_id = 101;
23 optional Expr session_id = 102;
24 }
25
26 message Statements {
27 // statements are `|` separated
28 repeated Statement statements = 1;
29 RenderStatement render = 2;
30 }
31
32 message Statement {
33 oneof stmt {
34 FilterOperator filter = 1;
35 SummarizeOperator summarize = 2;
36 ProjectOperator project = 300;
37 ProjectAwayOperator project_away = 301;
38 ProjectKeepOperator project_keep = 302;
39 ExtendOperator extend = 4;
40 CountOperator count = 5;
41 DistinctOperator distinct = 6;
42 SampleOperator sample = 7;
43 SearchOperator search = 8;
44 SortOperator sort = 9;
45 TakeOperator take = 10;
46 TopOperator top = 11;
47 }
48 }
49
50 message FilterOperator {
51 Expr expr = 1;
52 }
53
54 message SummarizeOperator {
55 message Parameters {
56 repeated Parameter parameters = 1;
57 }
58 message Parameter {
59 optional Identifier column = 1;
60 FuncCall aggregate_function = 2;
61 }
62 message ByGroupExpressions {
63 repeated ByGroupExpression groups = 2;
64 }
65 message ByGroupExpression {
66 optional Identifier column = 1;
67 Expr scalar = 2;
68 }
69 Parameters parameters = 1;
70 optional ByGroupExpressions by_group_expressions = 2;
71 }
72
73 message ProjectOperator {
74 message Projection {
75 Identifier column = 1;
76 optional Expr value = 2;
77 }
78 repeated Projection projections = 1;
79 }
80
81 message ProjectAwayOperator {
82 message Projection {
83 Identifier column = 1;
84 }
85 repeated Projection projections = 1;
86 }
87
88 message ProjectKeepOperator {
89 message Projection {
90 Identifier column = 1;
91 }
92 repeated Projection projections = 1;
93 }
94
95 message ExtendOperator {
96 message Projection {
97 Identifier column = 1;
98 Expr value = 2;
99 }
100 repeated Projection projections = 1;
101 }
102
103 message CountOperator {}
104
105 message DistinctOperator {
106 repeated Identifier fields = 1;
107 }
108
109 message SampleOperator {
110 int64 count = 1;
111 }
112
113 message SearchOperator {
114 enum Kind {
115 Default = 0;
116 CaseInsensitive = 1;
117 CaseSensitive = 2;
118 }
119 message Literal {
120 string literal = 1;
121 }
122 message FieldSearch {
123 string column = 1;
124 string literal = 2;
125 }
126 message ExactSearch {
127 string column = 1;
128 string literal = 2;
129 }
130 message RegexSearch {
131 string column = 1;
132 string regex = 2;
133 }
134 oneof predicate {
135 string literal = 101;
136 FieldSearch field = 102;
137 ExactSearch exact = 103;
138 RegexSearch regex = 104;
139 }
140 optional Kind kind = 2;
141 }
142
143 message SortOperator {
144 enum Order {
145 Desc = 0;
146 Asc = 1;
147 }
148 message ByColumn {
149 Identifier column = 1;
150 optional Order order = 2;
151 }
152 repeated ByColumn by_columns = 1;
153 }
154
155 message TakeOperator {
156 int64 count = 1;
157 }
158
159 message TopOperator {
160 enum Order {
161 Desc = 0;
162 Asc = 1;
163 }
164 message ByColumn {
165 Expr scalar = 1;
166 optional Order order = 2;
167 }
168 int64 count = 1;
169 optional ByColumn by_column = 2;
170 }
171
172 message RenderStatement {
173 oneof stmt {
174 SplitOperator split = 1;
175 }
176 }
177
178 message SplitOperator {
179 message ByOperator {
180 repeated Expr scalars = 1;
181 }
182 ByOperator by = 2;
183 }
184
185 message Expr {
186 oneof expr {
187 Val literal = 101;
188 UnaryOp unary = 102;
189 BinaryOp binary = 103;
190 FuncCall func_call = 104;
191 Identifier identifier = 105;
192 Indexor indexor = 106; // kvs['hello']
193 }
194 }
195
196 message UnaryOp {
197 enum Operator {
198 INVALID = 0;
199 NOT = 1;
200 NEG = 2;
201 }
202 Operator op = 1;
203 Expr arg = 2;
204 }
205
206 message BinaryOp {
207 enum Operator {
208 INVALID = 0;
209 LOG_AND = 101;
210 LOG_OR = 102;
211 NUM_ADD = 201;
212 NUM_SUB = 202;
213 NUM_DIV = 203;
214 NUM_MUL = 204;
215 NUM_MOD = 205;
216 CMP_EQ = 301;
217 CMP_NOTEQ = 302;
218 CMP_GT = 303;
219 CMP_GTE = 304;
220 CMP_LT = 305;
221 CMP_LTE = 306;
222 SET_IN = 401;
223 SET_NOTIN = 402;
224
225 STR_EQ_NOCS = 501;
226 STR_NOTEQ_NOCS = 502;
227 STR_CONTAINS = 503;
228 STR_NOT_CONTAINS = 504;
229 STR_CONTAINS_CS = 505;
230 STR_NOT_CONTAINS_CS = 506;
231 STR_STARTSWITH = 507;
232 STR_NOT_STARTSWITH = 508;
233 STR_STARTSWITH_CS = 509;
234 STR_NOT_STARTSWITH_CS = 510;
235 STR_ENDSWITH = 511;
236 STR_NOT_ENDSWITH = 512;
237 STR_ENDSWITH_CS = 513;
238 STR_NOT_ENDSWITH_CS = 514;
239 STR_IN_NOCS = 515;
240 STR_NOT_IN_NOCS = 516;
241 STR_NOT_MATCHES_REGEX = 517;
242 STR_MATCHES_REGEX = 518;
243 STR_HAS = 519;
244 STR_HAS_CS = 520;
245 STR_HASSUFFIX = 521;
246 STR_HASSUFFIX_CS = 522;
247 STR_HASPREFIX = 523;
248 STR_HASPREFIX_CS = 524;
249 }
250 Expr lhs = 1;
251 Operator op = 2;
252 Expr rhs = 3;
253 }
254
255 message FuncCall {
256 string name = 1;
257 repeated Expr args = 2;
258 }
259
260 message Identifier {
261 string name = 1;
262 }
263
264 message Indexor {
265 Expr x = 1;
266 Expr index = 2;
267 }