master
h 58 lines 4.09 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_RRDR_OPTIONS_H
4 #define NETDATA_RRDR_OPTIONS_H
5
6 #include "libnetdata/libnetdata.h"
7
8 typedef enum rrdr_options {
9 RRDR_OPTION_NONZERO = (1ULL << 0), // don't output dimensions with just zero values
10 RRDR_OPTION_REVERSED = (1ULL << 1), // output the rows in reverse order (oldest to newest)
11 RRDR_OPTION_ABSOLUTE = (1ULL << 2), // values positive, for DATASOURCE_SSV before summing
12 RRDR_OPTION_DIMS_MIN2MAX = (1ULL << 3), // when adding dimensions, use max - min, instead of sum
13 RRDR_OPTION_DIMS_AVERAGE = (1ULL << 4), // when adding dimensions, use average, instead of sum
14 RRDR_OPTION_DIMS_MIN = (1ULL << 5), // when adding dimensions, use minimum, instead of sum
15 RRDR_OPTION_DIMS_MAX = (1ULL << 6), // when adding dimensions, use maximum, instead of sum
16 RRDR_OPTION_SECONDS = (1ULL << 7), // output seconds, instead of dates
17 RRDR_OPTION_MILLISECONDS = (1ULL << 8), // output milliseconds, instead of dates
18 RRDR_OPTION_NULL2ZERO = (1ULL << 9), // do not show nulls, convert them to zeros
19 RRDR_OPTION_OBJECTSROWS = (1ULL << 10), // each row of values should be an object, not an array
20 RRDR_OPTION_GOOGLE_JSON = (1ULL << 11), // comply with google JSON/JSONP specs
21 RRDR_OPTION_JSON_WRAP = (1ULL << 12), // wrap the response in a JSON header with info about the result
22 RRDR_OPTION_LABEL_QUOTES = (1ULL << 13), // in CSV output, wrap header labels in double quotes
23 RRDR_OPTION_PERCENTAGE = (1ULL << 14), // give values as percentage of total
24 RRDR_OPTION_NOT_ALIGNED = (1ULL << 15), // do not align charts for persistent timeframes
25 RRDR_OPTION_DISPLAY_ABS = (1ULL << 16), // for badges, display the absolute value, but calculate colors with sign
26 RRDR_OPTION_MATCH_IDS = (1ULL << 17), // when filtering dimensions, match only IDs
27 RRDR_OPTION_MATCH_NAMES = (1ULL << 18), // when filtering dimensions, match only names
28 RRDR_OPTION_NATURAL_POINTS = (1ULL << 19), // return the natural points of the database
29 RRDR_OPTION_VIRTUAL_POINTS = (1ULL << 20), // return virtual points
30 RRDR_OPTION_ANOMALY_BIT = (1ULL << 21), // Return the anomaly bit stored in each collected_number
31 RRDR_OPTION_RETURN_RAW = (1ULL << 22), // Return raw data for aggregating across multiple nodes
32 RRDR_OPTION_RETURN_JWAR = (1ULL << 23), // Return anomaly rates in jsonwrap
33 RRDR_OPTION_SELECTED_TIER = (1ULL << 24), // Use the selected tier for the query
34 RRDR_OPTION_ALL_DIMENSIONS = (1ULL << 25), // Return the full dimensions list
35 RRDR_OPTION_SHOW_DETAILS = (1ULL << 26), // v2 returns detailed object tree
36 RRDR_OPTION_DEBUG = (1ULL << 27), // v2 returns request description
37 RRDR_OPTION_MINIFY = (1ULL << 28), // remove JSON spaces and newlines from JSON output
38 RRDR_OPTION_GROUP_BY_LABELS = (1ULL << 29), // v2 returns flattened labels per dimension of the chart
39 RRDR_OPTION_MINIMAL_STATS = (1ULL << 30), // Remove "totals" and statistics fields (qr, sl, ex) from response
40 RRDR_OPTION_LONG_JSON_KEYS = (1ULL << 31), // Use descriptive long JSON keys instead of cryptic short ones
41 RRDR_OPTION_MCP_INFO = (1ULL << 32), // Include "info" nodes in JSON response sections
42 RRDR_OPTION_RFC3339 = (1ULL << 33), // Return timestamps in RFC3339 format instead of epoch seconds
43
44 // internal ones - not to be exposed to the API
45 RRDR_OPTION_INTERNAL_AR = (1ULL << 63), // internal use only, to let the formatters know we want to render the anomaly rate
46 } RRDR_OPTIONS;
47
48 static_assert(sizeof(RRDR_OPTIONS) == 8, "RRDR_OPTIONS must be 8 bytes");
49
50 void rrdr_options_to_buffer(BUFFER *wb, RRDR_OPTIONS options);
51 void rrdr_options_to_buffer_json_array(BUFFER *wb, const char *key, RRDR_OPTIONS options);
52 void web_client_api_request_data_vX_options_to_string(char *buf, size_t size, RRDR_OPTIONS options);
53 void rrdr_options_init(void);
54
55 RRDR_OPTIONS rrdr_options_parse(const char *options_str);
56 RRDR_OPTIONS rrdr_options_parse_one(const char *o);
57
58 #endif //NETDATA_RRDR_OPTIONS_H