summaryrefslogtreecommitdiffstats
path: root/database/contexts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-17 09:30:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-17 09:30:23 +0000
commit517a443636daa1e8085cb4e5325524a54e8a8fd7 (patch)
tree5352109cc7cd5122274ab0cfc1f887b685f04edf /database/contexts
parentReleasing debian version 1.42.4-1. (diff)
downloadnetdata-517a443636daa1e8085cb4e5325524a54e8a8fd7.tar.xz
netdata-517a443636daa1e8085cb4e5325524a54e8a8fd7.zip
Merging upstream version 1.43.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/contexts')
-rw-r--r--database/contexts/api_v1.c6
-rw-r--r--database/contexts/api_v2.c21
-rw-r--r--database/contexts/instance.c8
-rw-r--r--database/contexts/internal.h2
-rw-r--r--database/contexts/query_target.c5
-rw-r--r--database/contexts/rrdcontext.h5
6 files changed, 31 insertions, 16 deletions
diff --git a/database/contexts/api_v1.c b/database/contexts/api_v1.c
index bc7fee496..f144e6f7b 100644
--- a/database/contexts/api_v1.c
+++ b/database/contexts/api_v1.c
@@ -213,7 +213,7 @@ static inline int rrdinstance_to_json_callback(const DICTIONARY_ITEM *item, void
buffer_json_array_close(wb);
}
- if(options & RRDCONTEXT_OPTION_SHOW_LABELS && ri->rrdlabels && dictionary_entries(ri->rrdlabels)) {
+ if(options & RRDCONTEXT_OPTION_SHOW_LABELS && ri->rrdlabels && rrdlabels_entries(ri->rrdlabels)) {
buffer_json_member_add_object(wb, "labels");
rrdlabels_to_buffer_json_members(ri->rrdlabels, wb);
buffer_json_object_close(wb);
@@ -366,7 +366,7 @@ int rrdcontext_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before, R
RRDCONTEXT *rc = rrdcontext_acquired_value(rca);
if(after != 0 && before != 0)
- rrdr_relative_window_to_absolute(&after, &before, NULL, false);
+ rrdr_relative_window_to_absolute_query(&after, &before, NULL, false);
buffer_json_initialize(wb, "\"", "\"", 0, true, BUFFER_JSON_OPTIONS_DEFAULT);
struct rrdcontext_to_json t_contexts = {
@@ -403,7 +403,7 @@ int rrdcontexts_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before,
uuid_unparse(*host->node_id, node_uuid);
if(after != 0 && before != 0)
- rrdr_relative_window_to_absolute(&after, &before, NULL, false);
+ rrdr_relative_window_to_absolute_query(&after, &before, NULL, false);
buffer_json_initialize(wb, "\"", "\"", 0, true, BUFFER_JSON_OPTIONS_DEFAULT);
buffer_json_member_add_string(wb, "hostname", rrdhost_hostname(host));
diff --git a/database/contexts/api_v2.c b/database/contexts/api_v2.c
index 08739160d..d0b27a2aa 100644
--- a/database/contexts/api_v2.c
+++ b/database/contexts/api_v2.c
@@ -184,6 +184,7 @@ struct alert_v2_entry {
RRDCALC *tmp;
STRING *name;
+ STRING *summary;
size_t ati;
@@ -315,6 +316,7 @@ static void alerts_v2_insert_callback(const DICTIONARY_ITEM *item __maybe_unused
struct alert_v2_entry *t = value;
RRDCALC *rc = t->tmp;
t->name = rc->name;
+ t->summary = rc->summary;
t->ati = ctl->alerts.ati++;
t->nodes = dictionary_create(DICT_OPTION_SINGLE_THREADED|DICT_OPTION_VALUE_LINK_DONT_CLONE|DICT_OPTION_NAME_LINK_DONT_CLONE);
@@ -355,6 +357,7 @@ static void alert_instances_v2_insert_callback(const DICTIONARY_ITEM *item __may
t->status = rc->status;
t->flags = rc->run_flags;
t->info = rc->info;
+ t->summary = rc->summary;
t->value = rc->value;
t->last_updated = rc->last_updated;
t->last_status_change = rc->last_status_change;
@@ -418,7 +421,7 @@ static FTS_MATCH rrdcontext_to_json_v2_full_text_search(struct rrdcontext_to_jso
dfe_done(rm);
size_t label_searches = 0;
- if(unlikely(ri->rrdlabels && dictionary_entries(ri->rrdlabels) &&
+ if(unlikely(ri->rrdlabels && rrdlabels_entries(ri->rrdlabels) &&
rrdlabels_match_simple_pattern_parsed(ri->rrdlabels, q, ':', &label_searches))) {
ctl->q.fts.searches += label_searches;
ctl->q.fts.char_searches += label_searches;
@@ -1009,8 +1012,8 @@ void buffer_json_agents_v2(BUFFER *wb, struct query_timings *timings, time_t now
STORAGE_ENGINE *eng = localhost->db[tier].eng;
if (!eng) continue;
- size_t max = storage_engine_disk_space_max(eng->backend, localhost->db[tier].instance);
- size_t used = storage_engine_disk_space_used(eng->backend, localhost->db[tier].instance);
+ uint64_t max = storage_engine_disk_space_max(eng->backend, localhost->db[tier].instance);
+ uint64_t used = storage_engine_disk_space_used(eng->backend, localhost->db[tier].instance);
time_t first_time_s = storage_engine_global_first_time_s(eng->backend, localhost->db[tier].instance);
size_t currently_collected_metrics = storage_engine_collected_metrics(eng->backend, localhost->db[tier].instance);
@@ -1280,6 +1283,7 @@ static void contexts_v2_alert_config_to_json_from_sql_alert_config_data(struct s
buffer_json_member_add_string(wb, "component", t->component);
buffer_json_member_add_string(wb, "type", t->type);
buffer_json_member_add_string(wb, "info", t->info);
+ buffer_json_member_add_string(wb, "summary", t->summary);
// buffer_json_member_add_string(wb, "source", t->source); // moved to alert instance
}
@@ -1343,6 +1347,7 @@ static int contexts_v2_alert_instance_to_json_callback(const DICTIONARY_ITEM *it
buffer_json_member_add_string(wb, "units", string2str(t->units));
buffer_json_member_add_string(wb, "fami", string2str(t->family));
buffer_json_member_add_string(wb, "info", string2str(t->info));
+ buffer_json_member_add_string(wb, "sum", string2str(t->summary));
buffer_json_member_add_string(wb, "ctx", string2str(t->context));
buffer_json_member_add_string(wb, "st", rrdcalc_status2string(t->status));
buffer_json_member_add_uuid(wb, "tr_i", &t->last_transition_id);
@@ -1397,6 +1402,7 @@ static void contexts_v2_alerts_to_json(BUFFER *wb, struct rrdcontext_to_json_v2_
{
buffer_json_member_add_uint64(wb, "ati", t->ati);
buffer_json_member_add_string(wb, "nm", string2str(t->name));
+ buffer_json_member_add_string(wb, "sum", string2str(t->summary));
buffer_json_member_add_uint64(wb, "cr", t->critical);
buffer_json_member_add_uint64(wb, "wr", t->warning);
@@ -1438,6 +1444,7 @@ struct sql_alert_transition_fixed_size {
char units[SQL_TRANSITION_DATA_SMALL_STRING];
char exec[SQL_TRANSITION_DATA_BIG_STRING];
char info[SQL_TRANSITION_DATA_BIG_STRING];
+ char summary[SQL_TRANSITION_DATA_BIG_STRING];
char classification[SQL_TRANSITION_DATA_SMALL_STRING];
char type[SQL_TRANSITION_DATA_SMALL_STRING];
char component[SQL_TRANSITION_DATA_SMALL_STRING];
@@ -1477,6 +1484,7 @@ static struct sql_alert_transition_fixed_size *contexts_v2_alert_transition_dup(
strncpyz(n->units, t->units ? t->units : "", sizeof(n->units) - 1);
strncpyz(n->exec, t->exec ? t->exec : "", sizeof(n->exec) - 1);
strncpyz(n->info, t->info ? t->info : "", sizeof(n->info) - 1);
+ strncpyz(n->summary, t->summary ? t->summary : "", sizeof(n->summary) - 1);
strncpyz(n->classification, t->classification ? t->classification : "", sizeof(n->classification) - 1);
strncpyz(n->type, t->type ? t->type : "", sizeof(n->type) - 1);
strncpyz(n->component, t->component ? t->component : "", sizeof(n->component) - 1);
@@ -1734,6 +1742,7 @@ static void contexts_v2_alert_transitions_to_json(BUFFER *wb, struct rrdcontext_
buffer_json_member_add_time_t(wb, "when", t->when_key);
buffer_json_member_add_string(wb, "info", *t->info ? t->info : "");
+ buffer_json_member_add_string(wb, "summary", *t->summary ? t->summary : "");
buffer_json_member_add_string(wb, "units", *t->units ? t->units : NULL);
buffer_json_member_add_object(wb, "new");
{
@@ -1934,7 +1943,9 @@ int rrdcontext_to_json_v2(BUFFER *wb, struct api_v2_contexts_request *req, CONTE
}
if(req->after || req->before) {
- ctl.window.relative = rrdr_relative_window_to_absolute(&ctl.window.after, &ctl.window.before, &ctl.now, false);
+ ctl.window.relative = rrdr_relative_window_to_absolute_query(&ctl.window.after, &ctl.window.before, &ctl.now
+ , false
+ );
ctl.window.enabled = !(mode & CONTEXTS_V2_ALERT_TRANSITIONS);
}
else
@@ -2023,7 +2034,7 @@ int rrdcontext_to_json_v2(BUFFER *wb, struct api_v2_contexts_request *req, CONTE
}
else {
buffer_strcat(wb, "query interrupted");
- resp = HTTP_RESP_BACKEND_FETCH_FAILED;
+ resp = HTTP_RESP_CLIENT_CLOSED_REQUEST;
}
goto cleanup;
}
diff --git a/database/contexts/instance.c b/database/contexts/instance.c
index 7e572fb80..8a60ce662 100644
--- a/database/contexts/instance.c
+++ b/database/contexts/instance.c
@@ -35,7 +35,7 @@ inline STRING *rrdinstance_acquired_units_dup(RRDINSTANCE_ACQUIRED *ria) {
return string_dup(ri->units);
}
-inline DICTIONARY *rrdinstance_acquired_labels(RRDINSTANCE_ACQUIRED *ria) {
+inline RRDLABELS *rrdinstance_acquired_labels(RRDINSTANCE_ACQUIRED *ria) {
RRDINSTANCE *ri = rrdinstance_acquired_value(ria);
return ri->rrdlabels;
}
@@ -68,7 +68,7 @@ inline time_t rrdinstance_acquired_update_every(RRDINSTANCE_ACQUIRED *ria) {
static void rrdinstance_free(RRDINSTANCE *ri) {
if(rrd_flag_check(ri, RRD_FLAG_OWN_LABELS))
- dictionary_destroy(ri->rrdlabels);
+ rrdlabels_destroy(ri->rrdlabels);
rrdmetrics_destroy_from_rrdinstance(ri);
string_freez(ri->id);
@@ -211,7 +211,7 @@ static bool rrdinstance_conflict_callback(const DICTIONARY_ITEM *item __maybe_un
ri->rrdset = ri_new->rrdset;
if(ri->rrdset && rrd_flag_check(ri, RRD_FLAG_OWN_LABELS)) {
- DICTIONARY *old = ri->rrdlabels;
+ RRDLABELS *old = ri->rrdlabels;
ri->rrdlabels = ri->rrdset->rrdlabels;
rrd_flag_clear(ri, RRD_FLAG_OWN_LABELS);
rrdlabels_destroy(old);
@@ -494,7 +494,7 @@ inline void rrdinstance_updated_rrdset_flags(RRDSET *st) {
RRDINSTANCE *ri = rrdset_get_rrdinstance(st);
if(unlikely(!ri)) return;
- if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED|RRDSET_FLAG_OBSOLETE)))
+ if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE)))
rrd_flag_set_archived(ri);
rrdinstance_updated_rrdset_flags_no_action(ri, st);
diff --git a/database/contexts/internal.h b/database/contexts/internal.h
index 04ad0883a..293659fdd 100644
--- a/database/contexts/internal.h
+++ b/database/contexts/internal.h
@@ -230,7 +230,7 @@ typedef struct rrdinstance {
time_t update_every_s; // data collection frequency
RRDSET *rrdset; // pointer to RRDSET when collected, or NULL
- DICTIONARY *rrdlabels; // linked to RRDSET->chart_labels or own version
+ RRDLABELS *rrdlabels; // linked to RRDSET->chart_labels or own version
struct rrdcontext *rc;
DICTIONARY *rrdmetrics;
diff --git a/database/contexts/query_target.c b/database/contexts/query_target.c
index 829640b90..d969691dd 100644
--- a/database/contexts/query_target.c
+++ b/database/contexts/query_target.c
@@ -1052,8 +1052,9 @@ QUERY_TARGET *query_target_create(QUERY_TARGET_REQUEST *qtr) {
if(query_target_has_percentage_of_group(qt))
qt->window.options &= ~RRDR_OPTION_PERCENTAGE;
- qt->internal.relative = rrdr_relative_window_to_absolute(&qt->window.after, &qt->window.before, &qt->window.now,
- unittest_running);
+ qt->internal.relative = rrdr_relative_window_to_absolute_query(&qt->window.after, &qt->window.before
+ , &qt->window.now, unittest_running
+ );
// prepare our local variables - we need these across all these functions
QUERY_TARGET_LOCALS qtl = {
diff --git a/database/contexts/rrdcontext.h b/database/contexts/rrdcontext.h
index 0bcdb68de..9c497a5a5 100644
--- a/database/contexts/rrdcontext.h
+++ b/database/contexts/rrdcontext.h
@@ -40,7 +40,7 @@ const char *rrdinstance_acquired_name(RRDINSTANCE_ACQUIRED *ria);
bool rrdinstance_acquired_has_name(RRDINSTANCE_ACQUIRED *ria);
const char *rrdinstance_acquired_units(RRDINSTANCE_ACQUIRED *ria);
STRING *rrdinstance_acquired_units_dup(RRDINSTANCE_ACQUIRED *ria);
-DICTIONARY *rrdinstance_acquired_labels(RRDINSTANCE_ACQUIRED *ria);
+RRDLABELS *rrdinstance_acquired_labels(RRDINSTANCE_ACQUIRED *ria);
DICTIONARY *rrdinstance_acquired_functions(RRDINSTANCE_ACQUIRED *ria);
RRDHOST *rrdinstance_acquired_rrdhost(RRDINSTANCE_ACQUIRED *ria);
RRDSET *rrdinstance_acquired_rrdset(RRDINSTANCE_ACQUIRED *ria);
@@ -432,6 +432,7 @@ struct sql_alert_transition_data {
const char *units;
const char *exec;
const char *info;
+ const char *summary;
const char *classification;
const char *type;
const char *component;
@@ -472,6 +473,7 @@ struct sql_alert_config_data {
const char *classification;
const char *component;
const char *type;
+ const char *summary;
struct {
struct {
@@ -531,6 +533,7 @@ struct sql_alert_instance_v2_entry {
RRDCALC_STATUS status;
RRDCALC_FLAGS flags;
STRING *info;
+ STRING *summary;
NETDATA_DOUBLE value;
time_t last_updated;
time_t last_status_change;