diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-14 18:12:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-14 18:12:14 +0000 |
commit | bb50acdcb8073654ea667b8c0272e335bd43f844 (patch) | |
tree | 1e00c8a29871426f8182658928dcb62e42d57ce8 /web/api/formatters/rrd2json.c | |
parent | Releasing debian version 1.33.1-1. (diff) | |
download | netdata-bb50acdcb8073654ea667b8c0272e335bd43f844.tar.xz netdata-bb50acdcb8073654ea667b8c0272e335bd43f844.zip |
Merging upstream version 1.34.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | web/api/formatters/rrd2json.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/web/api/formatters/rrd2json.c b/web/api/formatters/rrd2json.c index 29bb4beb5..1a8b07c7c 100644 --- a/web/api/formatters/rrd2json.c +++ b/web/api/formatters/rrd2json.c @@ -167,9 +167,10 @@ int rrdset2value_api_v1( , time_t *db_after , time_t *db_before , int *value_is_null + , int timeout ) { - RRDR *r = rrd2rrdr(st, points, after, before, group_method, group_time, options, dimensions, NULL); + RRDR *r = rrd2rrdr(st, points, after, before, group_method, group_time, options, dimensions, NULL, timeout); if(!r) { if(value_is_null) *value_is_null = 1; @@ -197,7 +198,7 @@ int rrdset2value_api_v1( if(db_before) *db_before = r->before; long i = (!(options & RRDR_OPTION_REVERSED))?rrdr_rows(r) - 1:0; - *n = rrdr2value(r, i, options, value_is_null); + *n = rrdr2value(r, i, options, value_is_null, NULL); rrdr_free(r); return HTTP_RESP_OK; @@ -217,17 +218,27 @@ int rrdset2anything_api_v1( , time_t *latest_timestamp , struct context_param *context_param_list , char *chart_label_key -) { - + , int max_anomaly_rates + , int timeout +) +{ if (context_param_list && !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) st->last_accessed_time = now_realtime_sec(); - RRDR *r = rrd2rrdr(st, points, after, before, group_method, group_time, options, dimensions?buffer_tostring(dimensions):NULL, context_param_list); + RRDR *r = rrd2rrdr(st, points, after, before, group_method, group_time, options, dimensions?buffer_tostring(dimensions):NULL, context_param_list, timeout); if(!r) { buffer_strcat(wb, "Cannot generate output with these parameters on this chart."); return HTTP_RESP_INTERNAL_SERVER_ERROR; } + if (r->result_options & RRDR_RESULT_OPTION_CANCEL) { + rrdr_free(r); + return HTTP_RESP_BACKEND_FETCH_FAILED; + } + + if (st && st->state && st->state->is_ar_chart) + ml_process_rrdr(r, max_anomaly_rates); + RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; if(r->result_options & RRDR_RESULT_OPTION_RELATIVE) @@ -243,12 +254,12 @@ int rrdset2anything_api_v1( if(options & RRDR_OPTION_JSON_WRAP) { wb->contenttype = CT_APPLICATION_JSON; rrdr_json_wrapper_begin(r, wb, format, options, 1, context_param_list, chart_label_key); - rrdr2ssv(r, wb, options, "", " ", ""); + rrdr2ssv(r, wb, options, "", " ", "", temp_rd); rrdr_json_wrapper_end(r, wb, format, options, 1); } else { wb->contenttype = CT_TEXT_PLAIN; - rrdr2ssv(r, wb, options, "", " ", ""); + rrdr2ssv(r, wb, options, "", " ", "", temp_rd); } break; @@ -256,12 +267,12 @@ int rrdset2anything_api_v1( if(options & RRDR_OPTION_JSON_WRAP) { wb->contenttype = CT_APPLICATION_JSON; rrdr_json_wrapper_begin(r, wb, format, options, 1, context_param_list, chart_label_key); - rrdr2ssv(r, wb, options, "", ",", ""); + rrdr2ssv(r, wb, options, "", ",", "", temp_rd); rrdr_json_wrapper_end(r, wb, format, options, 1); } else { wb->contenttype = CT_TEXT_PLAIN; - rrdr2ssv(r, wb, options, "", ",", ""); + rrdr2ssv(r, wb, options, "", ",", "", temp_rd); } break; @@ -269,12 +280,12 @@ int rrdset2anything_api_v1( if(options & RRDR_OPTION_JSON_WRAP) { wb->contenttype = CT_APPLICATION_JSON; rrdr_json_wrapper_begin(r, wb, format, options, 0, context_param_list, chart_label_key); - rrdr2ssv(r, wb, options, "[", ",", "]"); + rrdr2ssv(r, wb, options, "[", ",", "]", temp_rd); rrdr_json_wrapper_end(r, wb, format, options, 0); } else { wb->contenttype = CT_APPLICATION_JSON; - rrdr2ssv(r, wb, options, "[", ",", "]"); + rrdr2ssv(r, wb, options, "[", ",", "]", temp_rd); } break; |