summaryrefslogtreecommitdiffstats
path: root/src/web/api/maps
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:33:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:34:10 +0000
commit83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch)
tree2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/web/api/maps
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz
netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/web/api/maps')
-rw-r--r--src/web/api/maps/contexts_alert_statuses.c60
-rw-r--r--src/web/api/maps/contexts_alert_statuses.h26
-rw-r--r--src/web/api/maps/contexts_options.c58
-rw-r--r--src/web/api/maps/contexts_options.h22
-rw-r--r--src/web/api/maps/datasource_formats.c89
-rw-r--r--src/web/api/maps/datasource_formats.h32
-rw-r--r--src/web/api/maps/maps.h12
-rw-r--r--src/web/api/maps/rrdr_options.c139
-rw-r--r--src/web/api/maps/rrdr_options.h52
9 files changed, 490 insertions, 0 deletions
diff --git a/src/web/api/maps/contexts_alert_statuses.c b/src/web/api/maps/contexts_alert_statuses.c
new file mode 100644
index 000000000..d3565c9e8
--- /dev/null
+++ b/src/web/api/maps/contexts_alert_statuses.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "contexts_alert_statuses.h"
+
+static struct {
+ const char *name;
+ uint32_t hash;
+ CONTEXTS_ALERT_STATUS value;
+} contexts_alert_status[] = {
+ {"uninitialized" , 0 , CONTEXT_ALERT_UNINITIALIZED}
+ , {"undefined" , 0 , CONTEXT_ALERT_UNDEFINED}
+ , {"clear" , 0 , CONTEXT_ALERT_CLEAR}
+ , {"raised" , 0 , CONTEXT_ALERT_RAISED}
+ , {"active" , 0 , CONTEXT_ALERT_RAISED}
+ , {"warning" , 0 , CONTEXT_ALERT_WARNING}
+ , {"critical" , 0 , CONTEXT_ALERT_CRITICAL}
+ , {NULL , 0 , 0}
+};
+
+CONTEXTS_ALERT_STATUS contexts_alert_status_str_to_id(char *o) {
+ CONTEXTS_ALERT_STATUS ret = 0;
+ char *tok;
+
+ while(o && *o && (tok = strsep_skip_consecutive_separators(&o, ", |"))) {
+ if(!*tok) continue;
+
+ uint32_t hash = simple_hash(tok);
+ int i;
+ for(i = 0; contexts_alert_status[i].name ; i++) {
+ if (unlikely(hash == contexts_alert_status[i].hash && !strcmp(tok, contexts_alert_status[i].name))) {
+ ret |= contexts_alert_status[i].value;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+void contexts_alerts_status_to_buffer_json_array(BUFFER *wb, const char *key,
+ CONTEXTS_ALERT_STATUS options) {
+ buffer_json_member_add_array(wb, key);
+
+ CONTEXTS_ALERT_STATUS used = 0; // to prevent adding duplicates
+ for(int i = 0; contexts_alert_status[i].name ; i++) {
+ if (unlikely((contexts_alert_status[i].value & options) && !(contexts_alert_status[i].value & used))) {
+ const char *name = contexts_alert_status[i].name;
+ used |= contexts_alert_status[i].value;
+
+ buffer_json_add_array_item_string(wb, name);
+ }
+ }
+
+ buffer_json_array_close(wb);
+}
+
+void contexts_alert_statuses_init(void) {
+ for(size_t i = 0; contexts_alert_status[i].name ; i++)
+ contexts_alert_status[i].hash = simple_hash(contexts_alert_status[i].name);
+}
diff --git a/src/web/api/maps/contexts_alert_statuses.h b/src/web/api/maps/contexts_alert_statuses.h
new file mode 100644
index 000000000..1c38cb976
--- /dev/null
+++ b/src/web/api/maps/contexts_alert_statuses.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_CONTEXTS_ALERT_STATUSES_H
+#define NETDATA_CONTEXTS_ALERT_STATUSES_H
+
+#include "libnetdata/libnetdata.h"
+
+typedef enum contexts_alert_status {
+ CONTEXT_ALERT_UNINITIALIZED = (1 << 6), // include UNINITIALIZED alerts
+ CONTEXT_ALERT_UNDEFINED = (1 << 7), // include UNDEFINED alerts
+ CONTEXT_ALERT_CLEAR = (1 << 8), // include CLEAR alerts
+ CONTEXT_ALERT_RAISED = (1 << 9), // include WARNING & CRITICAL alerts
+ CONTEXT_ALERT_WARNING = (1 << 10), // include WARNING alerts
+ CONTEXT_ALERT_CRITICAL = (1 << 11), // include CRITICAL alerts
+} CONTEXTS_ALERT_STATUS;
+
+#define CONTEXTS_ALERT_STATUSES (CONTEXT_ALERT_UNINITIALIZED | CONTEXT_ALERT_UNDEFINED | CONTEXT_ALERT_CLEAR | \
+ CONTEXT_ALERT_RAISED | CONTEXT_ALERT_WARNING | CONTEXT_ALERT_CRITICAL)
+
+CONTEXTS_ALERT_STATUS contexts_alert_status_str_to_id(char *o);
+void contexts_alerts_status_to_buffer_json_array(BUFFER *wb, const char *key,
+ CONTEXTS_ALERT_STATUS options);
+
+void contexts_alert_statuses_init(void);
+
+#endif //NETDATA_CONTEXTS_ALERT_STATUSES_H
diff --git a/src/web/api/maps/contexts_options.c b/src/web/api/maps/contexts_options.c
new file mode 100644
index 000000000..22e50e8d7
--- /dev/null
+++ b/src/web/api/maps/contexts_options.c
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "contexts_options.h"
+
+static struct {
+ const char *name;
+ uint32_t hash;
+ CONTEXTS_OPTIONS value;
+} contexts_options[] = {
+ {"minify" , 0 , CONTEXTS_OPTION_MINIFY}
+ , {"debug" , 0 , CONTEXTS_OPTION_DEBUG}
+ , {"config" , 0 , CONTEXTS_OPTION_ALERTS_WITH_CONFIGURATIONS}
+ , {"instances" , 0 , CONTEXTS_OPTION_ALERTS_WITH_INSTANCES}
+ , {"values" , 0 , CONTEXTS_OPTION_ALERTS_WITH_VALUES}
+ , {"summary" , 0 , CONTEXTS_OPTION_ALERTS_WITH_SUMMARY}
+ , {NULL , 0 , 0}
+};
+
+CONTEXTS_OPTIONS contexts_options_str_to_id(char *o) {
+ CONTEXTS_OPTIONS ret = 0;
+ char *tok;
+
+ while(o && *o && (tok = strsep_skip_consecutive_separators(&o, ", |"))) {
+ if(!*tok) continue;
+
+ uint32_t hash = simple_hash(tok);
+ int i;
+ for(i = 0; contexts_options[i].name ; i++) {
+ if (unlikely(hash == contexts_options[i].hash && !strcmp(tok, contexts_options[i].name))) {
+ ret |= contexts_options[i].value;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+void contexts_options_to_buffer_json_array(BUFFER *wb, const char *key, CONTEXTS_OPTIONS options) {
+ buffer_json_member_add_array(wb, key);
+
+ CONTEXTS_OPTIONS used = 0; // to prevent adding duplicates
+ for(int i = 0; contexts_options[i].name ; i++) {
+ if (unlikely((contexts_options[i].value & options) && !(contexts_options[i].value & used))) {
+ const char *name = contexts_options[i].name;
+ used |= contexts_options[i].value;
+
+ buffer_json_add_array_item_string(wb, name);
+ }
+ }
+
+ buffer_json_array_close(wb);
+}
+
+void contexts_options_init(void) {
+ for(size_t i = 0; contexts_options[i].name ; i++)
+ contexts_options[i].hash = simple_hash(contexts_options[i].name);
+}
diff --git a/src/web/api/maps/contexts_options.h b/src/web/api/maps/contexts_options.h
new file mode 100644
index 000000000..a21bd76ca
--- /dev/null
+++ b/src/web/api/maps/contexts_options.h
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_CONTEXTS_OPTIONS_H
+#define NETDATA_CONTEXTS_OPTIONS_H
+
+#include "libnetdata/libnetdata.h"
+
+typedef enum contexts_options {
+ CONTEXTS_OPTION_MINIFY = (1 << 0), // remove JSON spaces and newlines from JSON output
+ CONTEXTS_OPTION_DEBUG = (1 << 1), // show the request
+ CONTEXTS_OPTION_ALERTS_WITH_CONFIGURATIONS = (1 << 2), // include alert configurations (used by /api/v2/alert_transitions)
+ CONTEXTS_OPTION_ALERTS_WITH_INSTANCES = (1 << 3), // include alert instances (used by /api/v2/alerts)
+ CONTEXTS_OPTION_ALERTS_WITH_VALUES = (1 << 4), // include alert latest values (used by /api/v2/alerts)
+ CONTEXTS_OPTION_ALERTS_WITH_SUMMARY = (1 << 5), // include alerts summary counters (used by /api/v2/alerts)
+} CONTEXTS_OPTIONS;
+
+CONTEXTS_OPTIONS contexts_options_str_to_id(char *o);
+void contexts_options_to_buffer_json_array(BUFFER *wb, const char *key, CONTEXTS_OPTIONS options);
+
+void contexts_options_init(void);
+
+#endif //NETDATA_CONTEXTS_OPTIONS_H
diff --git a/src/web/api/maps/datasource_formats.c b/src/web/api/maps/datasource_formats.c
new file mode 100644
index 000000000..33e1e7457
--- /dev/null
+++ b/src/web/api/maps/datasource_formats.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "datasource_formats.h"
+
+static struct {
+ const char *name;
+ uint32_t hash;
+ DATASOURCE_FORMAT value;
+} google_data_formats[] = {
+ // this is not an error - when Google requests json, it expects javascript
+ // https://developers.google.com/chart/interactive/docs/dev/implementing_data_source#responseformat
+ {"json", 0, DATASOURCE_DATATABLE_JSONP}
+ , {"html", 0, DATASOURCE_HTML}
+ , {"csv", 0, DATASOURCE_CSV}
+ , {"tsv-excel", 0, DATASOURCE_TSV}
+
+ // terminator
+ , {NULL, 0, 0}
+};
+
+inline DATASOURCE_FORMAT google_data_format_str_to_id(char *name) {
+ uint32_t hash = simple_hash(name);
+ int i;
+
+ for(i = 0; google_data_formats[i].name ; i++) {
+ if (unlikely(hash == google_data_formats[i].hash && !strcmp(name, google_data_formats[i].name))) {
+ return google_data_formats[i].value;
+ }
+ }
+
+ return DATASOURCE_JSON;
+}
+
+// --------------------------------------------------------------------------------------------------------------------
+
+static struct {
+ const char *name;
+ uint32_t hash;
+ DATASOURCE_FORMAT value;
+} datasource_formats[] = {
+ { "datatable" , 0 , DATASOURCE_DATATABLE_JSON}
+ , {"datasource" , 0 , DATASOURCE_DATATABLE_JSONP}
+ , {"json" , 0 , DATASOURCE_JSON}
+ , {"json2" , 0 , DATASOURCE_JSON2}
+ , {"jsonp" , 0 , DATASOURCE_JSONP}
+ , {"ssv" , 0 , DATASOURCE_SSV}
+ , {"csv" , 0 , DATASOURCE_CSV}
+ , {"tsv" , 0 , DATASOURCE_TSV}
+ , {"tsv-excel" , 0 , DATASOURCE_TSV}
+ , {"html" , 0 , DATASOURCE_HTML}
+ , {"array" , 0 , DATASOURCE_JS_ARRAY}
+ , {"ssvcomma" , 0 , DATASOURCE_SSV_COMMA}
+ , {"csvjsonarray" , 0 , DATASOURCE_CSV_JSON_ARRAY}
+ , {"markdown" , 0 , DATASOURCE_CSV_MARKDOWN}
+
+ // terminator
+ , {NULL, 0, 0}
+};
+
+DATASOURCE_FORMAT datasource_format_str_to_id(char *name) {
+ uint32_t hash = simple_hash(name);
+ int i;
+
+ for(i = 0; datasource_formats[i].name ; i++) {
+ if (unlikely(hash == datasource_formats[i].hash && !strcmp(name, datasource_formats[i].name))) {
+ return datasource_formats[i].value;
+ }
+ }
+
+ return DATASOURCE_JSON;
+}
+
+const char *rrdr_format_to_string(DATASOURCE_FORMAT format) {
+ for(size_t i = 0; datasource_formats[i].name ;i++)
+ if(unlikely(datasource_formats[i].value == format))
+ return datasource_formats[i].name;
+
+ return "unknown";
+}
+
+// --------------------------------------------------------------------------------------------------------------------
+
+void datasource_formats_init(void) {
+ for(size_t i = 0; datasource_formats[i].name ; i++)
+ datasource_formats[i].hash = simple_hash(datasource_formats[i].name);
+
+ for(size_t i = 0; google_data_formats[i].name ; i++)
+ google_data_formats[i].hash = simple_hash(google_data_formats[i].name);
+}
diff --git a/src/web/api/maps/datasource_formats.h b/src/web/api/maps/datasource_formats.h
new file mode 100644
index 000000000..50d8a82b4
--- /dev/null
+++ b/src/web/api/maps/datasource_formats.h
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_DATASOURCE_FORMATS_H
+#define NETDATA_DATASOURCE_FORMATS_H
+
+#include "libnetdata/libnetdata.h"
+
+// type of JSON generations
+typedef enum {
+ DATASOURCE_JSON = 0,
+ DATASOURCE_DATATABLE_JSON,
+ DATASOURCE_DATATABLE_JSONP,
+ DATASOURCE_SSV,
+ DATASOURCE_CSV,
+ DATASOURCE_JSONP,
+ DATASOURCE_TSV,
+ DATASOURCE_HTML,
+ DATASOURCE_JS_ARRAY,
+ DATASOURCE_SSV_COMMA,
+ DATASOURCE_CSV_JSON_ARRAY,
+ DATASOURCE_CSV_MARKDOWN,
+ DATASOURCE_JSON2,
+} DATASOURCE_FORMAT;
+
+DATASOURCE_FORMAT datasource_format_str_to_id(char *name);
+const char *rrdr_format_to_string(DATASOURCE_FORMAT format);
+
+DATASOURCE_FORMAT google_data_format_str_to_id(char *name);
+
+void datasource_formats_init(void);
+
+#endif //NETDATA_DATASOURCE_FORMATS_H
diff --git a/src/web/api/maps/maps.h b/src/web/api/maps/maps.h
new file mode 100644
index 000000000..25d210235
--- /dev/null
+++ b/src/web/api/maps/maps.h
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_MAPS_H
+#define NETDATA_MAPS_H
+
+#include "libnetdata/libnetdata.h"
+#include "datasource_formats.h"
+#include "contexts_options.h"
+#include "rrdr_options.h"
+#include "contexts_alert_statuses.h"
+
+#endif //NETDATA_MAPS_H
diff --git a/src/web/api/maps/rrdr_options.c b/src/web/api/maps/rrdr_options.c
new file mode 100644
index 000000000..41161d802
--- /dev/null
+++ b/src/web/api/maps/rrdr_options.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "rrdr_options.h"
+
+static struct {
+ const char *name;
+ uint32_t hash;
+ RRDR_OPTIONS value;
+} rrdr_options[] = {
+ { "nonzero" , 0 , RRDR_OPTION_NONZERO}
+ , {"flip" , 0 , RRDR_OPTION_REVERSED}
+ , {"reversed" , 0 , RRDR_OPTION_REVERSED}
+ , {"reverse" , 0 , RRDR_OPTION_REVERSED}
+ , {"jsonwrap" , 0 , RRDR_OPTION_JSON_WRAP}
+ , {"min2max" , 0 , RRDR_OPTION_DIMS_MIN2MAX} // rrdr2value() only
+ , {"average" , 0 , RRDR_OPTION_DIMS_AVERAGE} // rrdr2value() only
+ , {"min" , 0 , RRDR_OPTION_DIMS_MIN} // rrdr2value() only
+ , {"max" , 0 , RRDR_OPTION_DIMS_MAX} // rrdr2value() only
+ , {"ms" , 0 , RRDR_OPTION_MILLISECONDS}
+ , {"milliseconds" , 0 , RRDR_OPTION_MILLISECONDS}
+ , {"absolute" , 0 , RRDR_OPTION_ABSOLUTE}
+ , {"abs" , 0 , RRDR_OPTION_ABSOLUTE}
+ , {"absolute_sum" , 0 , RRDR_OPTION_ABSOLUTE}
+ , {"absolute-sum" , 0 , RRDR_OPTION_ABSOLUTE}
+ , {"display_absolute" , 0 , RRDR_OPTION_DISPLAY_ABS}
+ , {"display-absolute" , 0 , RRDR_OPTION_DISPLAY_ABS}
+ , {"seconds" , 0 , RRDR_OPTION_SECONDS}
+ , {"null2zero" , 0 , RRDR_OPTION_NULL2ZERO}
+ , {"objectrows" , 0 , RRDR_OPTION_OBJECTSROWS}
+ , {"google_json" , 0 , RRDR_OPTION_GOOGLE_JSON}
+ , {"google-json" , 0 , RRDR_OPTION_GOOGLE_JSON}
+ , {"percentage" , 0 , RRDR_OPTION_PERCENTAGE}
+ , {"unaligned" , 0 , RRDR_OPTION_NOT_ALIGNED}
+ , {"match_ids" , 0 , RRDR_OPTION_MATCH_IDS}
+ , {"match-ids" , 0 , RRDR_OPTION_MATCH_IDS}
+ , {"match_names" , 0 , RRDR_OPTION_MATCH_NAMES}
+ , {"match-names" , 0 , RRDR_OPTION_MATCH_NAMES}
+ , {"anomaly-bit" , 0 , RRDR_OPTION_ANOMALY_BIT}
+ , {"selected-tier" , 0 , RRDR_OPTION_SELECTED_TIER}
+ , {"raw" , 0 , RRDR_OPTION_RETURN_RAW}
+ , {"jw-anomaly-rates" , 0 , RRDR_OPTION_RETURN_JWAR}
+ , {"natural-points" , 0 , RRDR_OPTION_NATURAL_POINTS}
+ , {"virtual-points" , 0 , RRDR_OPTION_VIRTUAL_POINTS}
+ , {"all-dimensions" , 0 , RRDR_OPTION_ALL_DIMENSIONS}
+ , {"details" , 0 , RRDR_OPTION_SHOW_DETAILS}
+ , {"debug" , 0 , RRDR_OPTION_DEBUG}
+ , {"plan" , 0 , RRDR_OPTION_DEBUG}
+ , {"minify" , 0 , RRDR_OPTION_MINIFY}
+ , {"group-by-labels" , 0 , RRDR_OPTION_GROUP_BY_LABELS}
+ , {"label-quotes" , 0 , RRDR_OPTION_LABEL_QUOTES}
+ , {NULL , 0 , 0}
+};
+
+RRDR_OPTIONS rrdr_options_parse_one(const char *o) {
+ RRDR_OPTIONS ret = 0;
+
+ if(!o || !*o) return ret;
+
+ uint32_t hash = simple_hash(o);
+ int i;
+ for(i = 0; rrdr_options[i].name ; i++) {
+ if (unlikely(hash == rrdr_options[i].hash && !strcmp(o, rrdr_options[i].name))) {
+ ret |= rrdr_options[i].value;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+RRDR_OPTIONS rrdr_options_parse(char *o) {
+ RRDR_OPTIONS ret = 0;
+ char *tok;
+
+ while(o && *o && (tok = strsep_skip_consecutive_separators(&o, ", |"))) {
+ if(!*tok) continue;
+ ret |= rrdr_options_parse_one(tok);
+ }
+
+ return ret;
+}
+
+void rrdr_options_to_buffer_json_array(BUFFER *wb, const char *key, RRDR_OPTIONS options) {
+ buffer_json_member_add_array(wb, key);
+
+ RRDR_OPTIONS used = 0; // to prevent adding duplicates
+ for(int i = 0; rrdr_options[i].name ; i++) {
+ if (unlikely((rrdr_options[i].value & options) && !(rrdr_options[i].value & used))) {
+ const char *name = rrdr_options[i].name;
+ used |= rrdr_options[i].value;
+
+ buffer_json_add_array_item_string(wb, name);
+ }
+ }
+
+ buffer_json_array_close(wb);
+}
+
+void rrdr_options_to_buffer(BUFFER *wb, RRDR_OPTIONS options) {
+ RRDR_OPTIONS used = 0; // to prevent adding duplicates
+ size_t added = 0;
+ for(int i = 0; rrdr_options[i].name ; i++) {
+ if (unlikely((rrdr_options[i].value & options) && !(rrdr_options[i].value & used))) {
+ const char *name = rrdr_options[i].name;
+ used |= rrdr_options[i].value;
+
+ if(added++) buffer_strcat(wb, " ");
+ buffer_strcat(wb, name);
+ }
+ }
+}
+
+void web_client_api_request_data_vX_options_to_string(char *buf, size_t size, RRDR_OPTIONS options) {
+ char *write = buf;
+ char *end = &buf[size - 1];
+
+ RRDR_OPTIONS used = 0; // to prevent adding duplicates
+ int added = 0;
+ for(int i = 0; rrdr_options[i].name ; i++) {
+ if (unlikely((rrdr_options[i].value & options) && !(rrdr_options[i].value & used))) {
+ const char *name = rrdr_options[i].name;
+ used |= rrdr_options[i].value;
+
+ if(added && write < end)
+ *write++ = ',';
+
+ while(*name && write < end)
+ *write++ = *name++;
+
+ added++;
+ }
+ }
+ *write = *end = '\0';
+}
+
+void rrdr_options_init(void) {
+ for(size_t i = 0; rrdr_options[i].name ; i++)
+ rrdr_options[i].hash = simple_hash(rrdr_options[i].name);
+}
diff --git a/src/web/api/maps/rrdr_options.h b/src/web/api/maps/rrdr_options.h
new file mode 100644
index 000000000..4b6697dba
--- /dev/null
+++ b/src/web/api/maps/rrdr_options.h
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_RRDR_OPTIONS_H
+#define NETDATA_RRDR_OPTIONS_H
+
+#include "libnetdata/libnetdata.h"
+
+typedef enum rrdr_options {
+ RRDR_OPTION_NONZERO = (1 << 0), // don't output dimensions with just zero values
+ RRDR_OPTION_REVERSED = (1 << 1), // output the rows in reverse order (oldest to newest)
+ RRDR_OPTION_ABSOLUTE = (1 << 2), // values positive, for DATASOURCE_SSV before summing
+ RRDR_OPTION_DIMS_MIN2MAX = (1 << 3), // when adding dimensions, use max - min, instead of sum
+ RRDR_OPTION_DIMS_AVERAGE = (1 << 4), // when adding dimensions, use average, instead of sum
+ RRDR_OPTION_DIMS_MIN = (1 << 5), // when adding dimensions, use minimum, instead of sum
+ RRDR_OPTION_DIMS_MAX = (1 << 6), // when adding dimensions, use maximum, instead of sum
+ RRDR_OPTION_SECONDS = (1 << 7), // output seconds, instead of dates
+ RRDR_OPTION_MILLISECONDS = (1 << 8), // output milliseconds, instead of dates
+ RRDR_OPTION_NULL2ZERO = (1 << 9), // do not show nulls, convert them to zeros
+ RRDR_OPTION_OBJECTSROWS = (1 << 10), // each row of values should be an object, not an array
+ RRDR_OPTION_GOOGLE_JSON = (1 << 11), // comply with google JSON/JSONP specs
+ RRDR_OPTION_JSON_WRAP = (1 << 12), // wrap the response in a JSON header with info about the result
+ RRDR_OPTION_LABEL_QUOTES = (1 << 13), // in CSV output, wrap header labels in double quotes
+ RRDR_OPTION_PERCENTAGE = (1 << 14), // give values as percentage of total
+ RRDR_OPTION_NOT_ALIGNED = (1 << 15), // do not align charts for persistent timeframes
+ RRDR_OPTION_DISPLAY_ABS = (1 << 16), // for badges, display the absolute value, but calculate colors with sign
+ RRDR_OPTION_MATCH_IDS = (1 << 17), // when filtering dimensions, match only IDs
+ RRDR_OPTION_MATCH_NAMES = (1 << 18), // when filtering dimensions, match only names
+ RRDR_OPTION_NATURAL_POINTS = (1 << 19), // return the natural points of the database
+ RRDR_OPTION_VIRTUAL_POINTS = (1 << 20), // return virtual points
+ RRDR_OPTION_ANOMALY_BIT = (1 << 21), // Return the anomaly bit stored in each collected_number
+ RRDR_OPTION_RETURN_RAW = (1 << 22), // Return raw data for aggregating across multiple nodes
+ RRDR_OPTION_RETURN_JWAR = (1 << 23), // Return anomaly rates in jsonwrap
+ RRDR_OPTION_SELECTED_TIER = (1 << 24), // Use the selected tier for the query
+ RRDR_OPTION_ALL_DIMENSIONS = (1 << 25), // Return the full dimensions list
+ RRDR_OPTION_SHOW_DETAILS = (1 << 26), // v2 returns detailed object tree
+ RRDR_OPTION_DEBUG = (1 << 27), // v2 returns request description
+ RRDR_OPTION_MINIFY = (1 << 28), // remove JSON spaces and newlines from JSON output
+ RRDR_OPTION_GROUP_BY_LABELS = (1 << 29), // v2 returns flattened labels per dimension of the chart
+
+ // internal ones - not to be exposed to the API
+ RRDR_OPTION_INTERNAL_AR = (1 << 31), // internal use only, to let the formatters know we want to render the anomaly rate
+} RRDR_OPTIONS;
+
+void rrdr_options_to_buffer(BUFFER *wb, RRDR_OPTIONS options);
+void rrdr_options_to_buffer_json_array(BUFFER *wb, const char *key, RRDR_OPTIONS options);
+void web_client_api_request_data_vX_options_to_string(char *buf, size_t size, RRDR_OPTIONS options);
+void rrdr_options_init(void);
+
+RRDR_OPTIONS rrdr_options_parse(char *o);
+RRDR_OPTIONS rrdr_options_parse_one(const char *o);
+
+#endif //NETDATA_RRDR_OPTIONS_H