summaryrefslogtreecommitdiffstats
path: root/web/api/queries/query.h
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/queries/query.h')
-rw-r--r--web/api/queries/query.h54
1 files changed, 46 insertions, 8 deletions
diff --git a/web/api/queries/query.h b/web/api/queries/query.h
index ebad5a1f..e6fdcfbe 100644
--- a/web/api/queries/query.h
+++ b/web/api/queries/query.h
@@ -7,7 +7,7 @@
extern "C" {
#endif
-typedef enum rrdr_grouping {
+typedef enum rrdr_time_grouping {
RRDR_GROUPING_UNDEFINED = 0,
RRDR_GROUPING_AVERAGE,
RRDR_GROUPING_MIN,
@@ -17,7 +17,7 @@ typedef enum rrdr_grouping {
RRDR_GROUPING_TRIMMED_MEAN1,
RRDR_GROUPING_TRIMMED_MEAN2,
RRDR_GROUPING_TRIMMED_MEAN3,
- RRDR_GROUPING_TRIMMED_MEAN5,
+ RRDR_GROUPING_TRIMMED_MEAN,
RRDR_GROUPING_TRIMMED_MEAN10,
RRDR_GROUPING_TRIMMED_MEAN15,
RRDR_GROUPING_TRIMMED_MEAN20,
@@ -36,7 +36,7 @@ typedef enum rrdr_grouping {
RRDR_GROUPING_PERCENTILE75,
RRDR_GROUPING_PERCENTILE80,
RRDR_GROUPING_PERCENTILE90,
- RRDR_GROUPING_PERCENTILE95,
+ RRDR_GROUPING_PERCENTILE,
RRDR_GROUPING_PERCENTILE97,
RRDR_GROUPING_PERCENTILE98,
RRDR_GROUPING_PERCENTILE99,
@@ -45,12 +45,50 @@ typedef enum rrdr_grouping {
RRDR_GROUPING_SES,
RRDR_GROUPING_DES,
RRDR_GROUPING_COUNTIF,
-} RRDR_GROUPING;
+} RRDR_TIME_GROUPING;
-const char *group_method2string(RRDR_GROUPING group);
-void web_client_api_v1_init_grouping(void);
-RRDR_GROUPING web_client_api_request_v1_data_group(const char *name, RRDR_GROUPING def);
-const char *web_client_api_request_v1_data_group_to_string(RRDR_GROUPING group);
+const char *time_grouping_method2string(RRDR_TIME_GROUPING group);
+void time_grouping_init(void);
+RRDR_TIME_GROUPING time_grouping_parse(const char *name, RRDR_TIME_GROUPING def);
+const char *time_grouping_tostring(RRDR_TIME_GROUPING group);
+
+typedef enum rrdr_group_by {
+ RRDR_GROUP_BY_NONE = 0,
+ RRDR_GROUP_BY_SELECTED = (1 << 0),
+ RRDR_GROUP_BY_DIMENSION = (1 << 1),
+ RRDR_GROUP_BY_INSTANCE = (1 << 2),
+ RRDR_GROUP_BY_LABEL = (1 << 3),
+ RRDR_GROUP_BY_NODE = (1 << 4),
+ RRDR_GROUP_BY_CONTEXT = (1 << 5),
+ RRDR_GROUP_BY_UNITS = (1 << 6),
+ RRDR_GROUP_BY_PERCENTAGE_OF_INSTANCE = (1 << 7),
+} RRDR_GROUP_BY;
+
+#define SUPPORTED_GROUP_BY_METHODS (\
+ RRDR_GROUP_BY_SELECTED |\
+ RRDR_GROUP_BY_DIMENSION |\
+ RRDR_GROUP_BY_INSTANCE |\
+ RRDR_GROUP_BY_LABEL |\
+ RRDR_GROUP_BY_NODE |\
+ RRDR_GROUP_BY_CONTEXT |\
+ RRDR_GROUP_BY_UNITS |\
+ RRDR_GROUP_BY_PERCENTAGE_OF_INSTANCE \
+)
+
+struct web_buffer;
+
+RRDR_GROUP_BY group_by_parse(char *s);
+void buffer_json_group_by_to_array(struct web_buffer *wb, RRDR_GROUP_BY group_by);
+
+typedef enum rrdr_group_by_function {
+ RRDR_GROUP_BY_FUNCTION_AVERAGE = 0,
+ RRDR_GROUP_BY_FUNCTION_MIN,
+ RRDR_GROUP_BY_FUNCTION_MAX,
+ RRDR_GROUP_BY_FUNCTION_SUM,
+} RRDR_GROUP_BY_FUNCTION;
+
+RRDR_GROUP_BY_FUNCTION group_by_aggregate_function_parse(const char *s);
+const char *group_by_aggregate_function_to_string(RRDR_GROUP_BY_FUNCTION group_by_function);
#ifdef __cplusplus
}