@cryptotaxi247 / netdata-1 / commits / e1411d238

Update functions tables docs (#17071)

* docs: update functions tables docs * chore: remove yellow color

Joao Cardoso committed Mar 11, 2024 at 13:08 UTC e1411d23820c11e42a99035d676371f4af2c205c
1 file changed +164 -12
src/collectors/plugins.d/functions-table.md
+164 -12
@@ -7,7 +7,7 @@ One of these responses is the `table`. This is used in almost all functions impl
7
8 # Functions Tables
9
10 -Tables are defined when `"type": "table"` is set. The following is the standard header that should be available on all `table` responses:
10 +Tables are defined when `"type": "table"` is set. The following is the standard header that should be available on all `table` responses:
11
12 ```json
13 {
@@ -56,7 +56,29 @@ The response from the plugin is expected to have the following:
56 If there are no required parameters, `required_params` can be omitted.
57 If there are no accepted parameters, `accepted_params` can be omitted. `accepted_param` can be sent during normal responses to update the UI with a new set of parameters available, between calls.
58
59 -If there are `required_params`, the UI by default selects the first option. [](VERIFY_WITH_UI)
59 +For `logs`, the UI requires this set of `accepted_params`.
60 +
61 +Ref [Pagination](#pagination), [Deltas](#incremental-responses)
62 +```json
63 +[
64 + "info", // boolean: requests the preflight `info` request
65 + "after", // interval start timestamp
66 + "before", // interval end timestamp
67 + "direction", // sort direction [backward,forward]
68 + "last", // number of records to retrieve
69 + "anchor", // timestamp to divide records in pages
70 + "facets",
71 + "histogram", // selects facet to be used on the histogram
72 + "if_modified_since", // used in PLAY mode, to indicate that the UI wants data newer than the specified timestamp
73 + "data_only", // boolean: requests data (logs) only
74 + "delta", // boolean: requests incremental responses
75 + "tail",
76 + "sampling",
77 + "slice"
78 +]
79 +```
80 +
81 +If there are `required_params`, the UI by default selects the first option. [](VERIFY_WITH_UI)
82
83 ## Table data
84
@@ -104,6 +126,10 @@ To define table data, the UI expects this:
126 }
127 ```
128
129 +**IMPORTANT**
130 +
131 +On Data values, `timestamp` column value must be in unix micro.
132 +
133
134 ### Sorting order
135
@@ -146,7 +172,7 @@ TBD
172
173 - `none`, this facet is not selectable by users
174 - `multiselect`, the user can select any number of the available options
149 -- `facet`, similar to `multiselect`, but it also indicates that the column has been indexed and has values with counters. Columns set to `facet` must appear in the `facets` list.
175 +- `facet`, similar to `multiselect`, but it also indicates that the column has been indexed and has values with counters. Columns set to `facet` must appear in the `facets` list.
176 - `range`, the user can select a range of values (numeric)
177
178 The plugin may send non visible columns with filter type `facet`. This means that the plugin can enable indexing on these columns, but it has not done it. Then the UI may send `facets:{ID1},{ID2},{ID3},...` to enable indexing of the columns specified.
@@ -155,7 +181,7 @@ What is the default?
181
182 #### Facets
183
158 -Facets are a special case of `multiselect` fields. They are used to provide additional information about each possible value, including their relative sort order and the number of times each value appears in the result set. Facets are filters handled by the plugin. So, the plugin will receive user selected filter like: `{KEY}:{VALUE1},{VALUE2},...`, where `{KEY}` is the id of the column and `{VALUEX}` is the id the facet option the user selected.
184 +Facets are a special case of `multiselect` fields. They are used to provide additional information about each possible value, including their relative sort order and the number of times each value appears in the result set. Facets are filters handled by the plugin. So, the plugin will receive user selected filter like: `{KEY}:{VALUE1},{VALUE2},...`, where `{KEY}` is the id of the column and `{VALUEX}` is the id the facet option the user selected.
185
186 ```json
187 {
@@ -166,6 +192,7 @@ Facets are a special case of `multiselect` fields. They are used to provide addi
192 {
193 "id": "string: the unique id of the facet",
194 "name": "string: the human readable name of the facet",
195 + "order": "integer: the sorting order of this facet - lower numbers move items above others"
196 "options": [
197 {
198 "id": "string: the unique id of the facet value",
@@ -187,10 +214,10 @@ Facets are a special case of `multiselect` fields. They are used to provide addi
214 {
215 // header,
216 "charts": {
190 -
217 +
218 },
219 "default_charts": [
193 -
220 +
221 ]
222 }
223 ```
@@ -200,23 +227,148 @@ Facets are a special case of `multiselect` fields. They are used to provide addi
227
228 ```json
229 {
203 - // header,
230 "available_histograms": [
205 -
231 + {
232 + "id": "string: the unique id of the histogram",
233 + "name": "string: the human readable name of the histogram",
234 + "order": "integer: the sorting order of available histograms - lower numbers move items above others"
235 + }
236 ],
237 "histogram": {
208 -
238 + "id": "string: the unique id of the histogram",
239 + "name": "string: the human readable name of the histogram",
240 + "chart": {
241 + "summary": {
242 + "nodes": [
243 + {
244 + "mg": "string",
245 + "nm": "string: node name",
246 + "ni": "integer: node index"
247 + }
248 + ],
249 + "contexts": [
250 + {
251 + "id": "string: context id"
252 + }
253 + ],
254 + "instances": [
255 + {
256 + "id": "string: instance id",
257 + "ni": "integer: instance index"
258 + }
259 + ],
260 + "dimensions": [
261 + {
262 + "id": "string: dimension id",
263 + "pri": "integer",
264 + "sts": {
265 + "min": "float: dimension min value",
266 + "max": "float: dimension max value",
267 + "avg": "float: dimension avarage value",
268 + "arp": "float",
269 + "con": "float"
270 + }
271 + }
272 + ]
273 + },
274 + "result": {
275 + "labels": [
276 + // histogram labels
277 + ],
278 + "point": {
279 + "value": "integer",
280 + "arp": "integer",
281 + "pa": "integer"
282 + },
283 + "data": [
284 + [
285 + "timestamp" // unix milli
286 + // one array per label
287 + [
288 + // values
289 + ],
290 + ]
291 + ]
292 + },
293 + "view": {
294 + "title": "string: histogram tittle",
295 + "update_every": "integer",
296 + "after": "timestamp: histogram window start",
297 + "before": "timestamp: histogram window end",
298 + "units": "string: histogram units",
299 + "chart_type": "string: histogram chart type",
300 + "min": "integer: histogram min value",
301 + "max": "integer: histogram max value",
302 + "dimensions": {
303 + "grouped_by": [
304 + // "string: histogram grouped by",
305 + ],
306 + "ids": [
307 + // "string: histogram label id",
308 + ],
309 + "names": [
310 + // "string: histogram human readable label name",
311 + ],
312 + "colors": [],
313 + "units": [
314 + // "string: histogram label unit",
315 + ],
316 + "sts": {
317 + "min": [
318 + // "float: label min value",
319 + ],
320 + "max": [
321 + // "float: label max value",
322 + ],
323 + "avg": [
324 + // "float: label avarage value",
325 + ],
326 + "arp": [
327 + // "float",
328 + ],
329 + "con": [
330 + // "float",
331 + ]
332 + }
333 + }
334 + },
335 + "totals": {
336 + "nodes": {
337 + "sl": "integer",
338 + "qr": "integer"
339 + },
340 + "contexts": {
341 + "sl": "integer",
342 + "qr": "integer"
343 + },
344 + "instances": {
345 + "sl": "integer",
346 + "qr": "integer"
347 + },
348 + "dimensions": {
349 + "sl": "integer",
350 + "qr": "integer"
351 + }
352 + },
353 + "db": {
354 + "update_every": "integer"
355 + }
356 + }
357 }
358 }
359 ```
360
361 +**IMPORTANT**
362 +
363 +On Result Data, `timestamps` must be in unix milli.
364 +
365 ## Grouping
366
367 ```json
368 {
369 // header,
370 "group_by": {
219 -
371 +
372 }
373 }
374 ```
@@ -248,8 +400,8 @@ The UI supports paginating results when `has_history: true`. So, when the result
400
401 Once pagination is enabled, the plugin must support the following parameters:
402
251 -- `{ANCHOR}:{VALUE}`, `{ANCHOR}` is the `pagination.key`, `{VALUE}` is the point the user wants to see entries at, formatted according to `pagination.units`.
252 -- `direction:backward` or `direction:forward` to specify if the data to be returned if before are after the anchor.
403 +- `{ANCHOR}:{VALUE}`, `{ANCHOR}` is the `pagination.key`, `{VALUE}` is the point the user wants to see entries at, formatted according to `pagination.units`.
404 +- `direction:backward` or `direction:forward` to specify if the data to be returned if before are after the anchor.
405 - `last:NUMER`, the number of entries the plugin should return in the table data.
406 - `query:STRING`, the full text search string the user wants to search for.
407 - `if_modified_since:TIMESTAMP_USEC` and `tail:true`, used in PLAY mode, to indicate that the UI wants data newer than the specified timestamp. If there are no new data, the plugin must respond with 304 (Not Modified).