summaryrefslogtreecommitdiffstats
path: root/src/database/contexts/api_v2_contexts.h
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/database/contexts/api_v2_contexts.h
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/database/contexts/api_v2_contexts.h')
-rw-r--r--src/database/contexts/api_v2_contexts.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/database/contexts/api_v2_contexts.h b/src/database/contexts/api_v2_contexts.h
new file mode 100644
index 000000000..3fb5354b9
--- /dev/null
+++ b/src/database/contexts/api_v2_contexts.h
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_API_V2_CONTEXTS_H
+#define NETDATA_API_V2_CONTEXTS_H
+
+#include "internal.h"
+
+typedef enum __attribute__ ((__packed__)) {
+ FTS_MATCHED_NONE = 0,
+ FTS_MATCHED_HOST,
+ FTS_MATCHED_CONTEXT,
+ FTS_MATCHED_INSTANCE,
+ FTS_MATCHED_DIMENSION,
+ FTS_MATCHED_LABEL,
+ FTS_MATCHED_ALERT,
+ FTS_MATCHED_ALERT_INFO,
+ FTS_MATCHED_FAMILY,
+ FTS_MATCHED_TITLE,
+ FTS_MATCHED_UNITS,
+} FTS_MATCH;
+
+typedef struct full_text_search_index {
+ size_t searches;
+ size_t string_searches;
+ size_t char_searches;
+} FTS_INDEX;
+
+struct contexts_v2_node {
+ size_t ni;
+ RRDHOST *host;
+};
+
+struct rrdcontext_to_json_v2_data {
+ time_t now;
+
+ BUFFER *wb;
+ struct api_v2_contexts_request *request;
+
+ CONTEXTS_V2_MODE mode;
+ CONTEXTS_OPTIONS options;
+ struct query_versions versions;
+
+ struct {
+ SIMPLE_PATTERN *scope_pattern;
+ SIMPLE_PATTERN *pattern;
+ size_t ni;
+ DICTIONARY *dict; // the result set
+ } nodes;
+
+ struct {
+ SIMPLE_PATTERN *scope_pattern;
+ SIMPLE_PATTERN *pattern;
+ size_t ci;
+ DICTIONARY *dict; // the result set
+ } contexts;
+
+ struct {
+ SIMPLE_PATTERN *alert_name_pattern;
+ time_t alarm_id_filter;
+
+ size_t ati;
+
+ DICTIONARY *summary;
+ DICTIONARY *alert_instances;
+
+ DICTIONARY *by_type;
+ DICTIONARY *by_component;
+ DICTIONARY *by_classification;
+ DICTIONARY *by_recipient;
+ DICTIONARY *by_module;
+ } alerts;
+
+ struct {
+ FTS_MATCH host_match;
+ char host_node_id_str[UUID_STR_LEN];
+ SIMPLE_PATTERN *pattern;
+ FTS_INDEX fts;
+ } q;
+
+ struct {
+ DICTIONARY *dict; // the result set
+ } functions;
+
+ struct {
+ bool enabled;
+ bool relative;
+ time_t after;
+ time_t before;
+ } window;
+
+ struct query_timings timings;
+};
+
+void agent_capabilities_to_json(BUFFER *wb, RRDHOST *host, const char *key);
+
+#include "api_v2_contexts_alerts.h"
+
+#endif //NETDATA_API_V2_CONTEXTS_H