| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_API_V2_CONTEXTS_ALERTS_H |
| 4 | #define NETDATA_API_V2_CONTEXTS_ALERTS_H |
| 5 | |
| 6 | #include "rrdcontext-internal.h" |
| 7 | #include "api_v2_contexts.h" |
| 8 | |
| 9 | struct alert_transitions_callback_data { |
| 10 | struct rrdcontext_to_json_v2_data *ctl; |
| 11 | BUFFER *wb; |
| 12 | bool debug; |
| 13 | bool only_one_config; |
| 14 | |
| 15 | struct { |
| 16 | SIMPLE_PATTERN *pattern; |
| 17 | DICTIONARY *dict; |
| 18 | } facets[ATF_TOTAL_ENTRIES]; |
| 19 | |
| 20 | uint32_t max_items_to_return; |
| 21 | uint32_t items_to_return; |
| 22 | |
| 23 | uint32_t items_evaluated; |
| 24 | uint32_t items_matched; |
| 25 | |
| 26 | |
| 27 | struct sql_alert_transition_fixed_size *base; // double linked list - last item is base->prev |
| 28 | struct sql_alert_transition_fixed_size *last_added; // the last item added, not the last of the list |
| 29 | |
| 30 | struct { |
| 31 | size_t first; |
| 32 | size_t skips_before; |
| 33 | size_t skips_after; |
| 34 | size_t backwards; |
| 35 | size_t forwards; |
| 36 | size_t prepend; |
| 37 | size_t append; |
| 38 | size_t shifts; |
| 39 | } operations; |
| 40 | |
| 41 | uint32_t configs_added; |
| 42 | }; |
| 43 | |
| 44 | void contexts_v2_alerts_to_json(BUFFER *wb, struct rrdcontext_to_json_v2_data *ctl, bool debug); |
| 45 | bool rrdcontext_matches_alert(struct rrdcontext_to_json_v2_data *ctl, RRDCONTEXT *rc); |
| 46 | void contexts_v2_alert_config_to_json_from_sql_alert_config_data(struct sql_alert_config_data *t, void *data); |
| 47 | void contexts_v2_alert_transitions_to_json(BUFFER *wb, struct rrdcontext_to_json_v2_data *ctl, bool debug); |
| 48 | |
| 49 | bool rrdcontexts_v2_init_alert_dictionaries(struct rrdcontext_to_json_v2_data *ctl, struct api_v2_contexts_request *req); |
| 50 | void rrdcontexts_v2_alerts_cleanup(struct rrdcontext_to_json_v2_data *ctl); |
| 51 | |
| 52 | #endif //NETDATA_API_V2_CONTEXTS_ALERTS_H |