diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-10-02 09:56:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 09:56:01 +0300 |
commit | 8c9492a4767001459d99e232b58f63baf1e95f91 (patch) | |
tree | 197db611d871a9d608f1462d82595fe84a8b1d65 /database/contexts/api_v2.c | |
parent | 3c98ee23124fefc761c3c67cc343b17fde366d2e (diff) |
Send alerts summary field to cloud (#16056)
* new aclk schema
* transmit summary to cloud and expose in v2/alerts
* missing assign
Diffstat (limited to 'database/contexts/api_v2.c')
-rw-r--r-- | database/contexts/api_v2.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/database/contexts/api_v2.c b/database/contexts/api_v2.c index 5f904718fa..dacf962a30 100644 --- a/database/contexts/api_v2.c +++ b/database/contexts/api_v2.c @@ -355,6 +355,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; @@ -1280,6 +1281,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 +1345,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); @@ -1438,6 +1441,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 +1481,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 +1739,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"); { |