From 5be9be74854d00879e6d52d6432ae12b5e8558cd Mon Sep 17 00:00:00 2001 From: Costa Tsaousis Date: Wed, 28 Jun 2023 23:14:10 +0300 Subject: rewrite /api/v2/alerts (#15257) * rewrite /api/v2/alerts * implement searching for transition * Find transition id and issue callback * Fix parameters * call and transition filter * Search with transition as well * renames and cleanup * render flags * what if scenario for moving transitions at the top level * If transition is given, limit the query appropriately * Add alert transitions * Optimize find transition to use prepared query Drop temp table properly * enabled alert instances again * Order by when key * Order by global_id * Return last X transitions * updated field names * add ati to configurations and show all keys in debug mode * Code cleanup and optimizations * Drop temp table in case of error * Finalize temp table population statement to prevent memory leak * final changes --------- Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> --- libnetdata/buffer/buffer.h | 2 +- libnetdata/eval/eval.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'libnetdata') diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h index 5aaa26a079..17a7b378c1 100644 --- a/libnetdata/buffer/buffer.h +++ b/libnetdata/buffer/buffer.h @@ -757,7 +757,7 @@ static inline void buffer_json_member_add_uuid(BUFFER *wb, const char *key, uuid buffer_print_json_key(wb, key); buffer_fast_strcat(wb, ":", 1); - if(value) { + if(value && !uuid_is_null(*value)) { char uuid[GUID_LEN + 1]; uuid_unparse_lower(*value, uuid); buffer_json_add_string_value(wb, uuid); diff --git a/libnetdata/eval/eval.c b/libnetdata/eval/eval.c index c7570bd2f9..6bf206febe 100644 --- a/libnetdata/eval/eval.c +++ b/libnetdata/eval/eval.c @@ -213,6 +213,13 @@ static inline NETDATA_DOUBLE eval_value(EVAL_EXPRESSION *exp, EVAL_VALUE *v, int break; } + if(likely(!*error)) { + if(unlikely(isnan(n))) + *error = EVAL_ERROR_VALUE_IS_NAN; + else if(unlikely(isinf(n))) + *error = EVAL_ERROR_VALUE_IS_INFINITE; + } + return n; } -- cgit v1.2.3