diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-18 15:22:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-18 15:22:14 +0000 |
commit | 970987c0d6e99ef0db866a09396d5613042a94d1 (patch) | |
tree | af21bdbc146083814d19b8d553f15e671ae7fd24 /web/api | |
parent | Releasing debian version 1.29.1-3. (diff) | |
download | netdata-970987c0d6e99ef0db866a09396d5613042a94d1.tar.xz netdata-970987c0d6e99ef0db866a09396d5613042a94d1.zip |
Merging upstream version 1.29.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api')
-rw-r--r-- | web/api/formatters/rrd2json.c | 27 | ||||
-rw-r--r-- | web/api/formatters/rrd2json.h | 1 | ||||
-rw-r--r-- | web/api/queries/query.c | 3 | ||||
-rw-r--r-- | web/api/queries/rrdr.c | 4 |
4 files changed, 32 insertions, 3 deletions
diff --git a/web/api/formatters/rrd2json.c b/web/api/formatters/rrd2json.c index 9168f76e..d8e24806 100644 --- a/web/api/formatters/rrd2json.c +++ b/web/api/formatters/rrd2json.c @@ -32,6 +32,30 @@ void free_context_param_list(struct context_param **param_list) *param_list = NULL; } +void rebuild_context_param_list(struct context_param *context_param_list, time_t after_requested) +{ + RRDDIM *temp_rd = context_param_list->rd; + RRDDIM *new_rd_list = NULL, *t; + while (temp_rd) { + t = temp_rd->next; + if (rrdset_last_entry_t(temp_rd->rrdset) >= after_requested) { + temp_rd->next = new_rd_list; + new_rd_list = temp_rd; + } else { + freez((char *)temp_rd->id); + freez((char *)temp_rd->name); +#ifdef ENABLE_DBENGINE + if (temp_rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) + freez(temp_rd->state->metric_uuid); +#endif + freez(temp_rd->state); + freez(temp_rd); + } + temp_rd = t; + } + context_param_list->rd = new_rd_list; +}; + void build_context_param_list(struct context_param **param_list, RRDSET *st) { if (unlikely(!param_list || !st)) @@ -193,7 +217,6 @@ int rrdset2anything_api_v1( time_t last_accessed_time = now_realtime_sec(); st->last_accessed_time = last_accessed_time; - RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; RRDR *r = rrd2rrdr(st, points, after, before, group_method, group_time, options, dimensions?buffer_tostring(dimensions):NULL, context_param_list); if(!r) { @@ -201,6 +224,8 @@ int rrdset2anything_api_v1( return HTTP_RESP_INTERNAL_SERVER_ERROR; } + RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; + if(r->result_options & RRDR_RESULT_OPTION_RELATIVE) buffer_no_cacheable(wb); else if(r->result_options & RRDR_RESULT_OPTION_ABSOLUTE) diff --git a/web/api/formatters/rrd2json.h b/web/api/formatters/rrd2json.h index 1f929c49..3dc59897 100644 --- a/web/api/formatters/rrd2json.h +++ b/web/api/formatters/rrd2json.h @@ -86,6 +86,7 @@ extern int rrdset2value_api_v1( ); extern void build_context_param_list(struct context_param **param_list, RRDSET *st); +extern void rebuild_context_param_list(struct context_param *context_param_list, time_t after_requested); extern void free_context_param_list(struct context_param **param_list); #endif /* NETDATA_RRD2JSON_H */ diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 3b9077cd..663e4bd1 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -1591,6 +1591,9 @@ RRDR *rrd2rrdr( if (first_entry_t > after_requested) first_entry_t = after_requested; + if (context_param_list) + rebuild_context_param_list(context_param_list, after_requested); + #ifdef ENABLE_DBENGINE if (st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { struct rrdeng_region_info *region_info_array; diff --git a/web/api/queries/rrdr.c b/web/api/queries/rrdr.c index 6cd0c0b1..ef237fa0 100644 --- a/web/api/queries/rrdr.c +++ b/web/api/queries/rrdr.c @@ -130,8 +130,8 @@ RRDR *rrdr_create(struct rrdset *st, long n, struct context_param *context_param // set the hidden flag on hidden dimensions int c; - for(c = 0, rd = temp_rd?temp_rd:st->dimensions ; rd ; c++, rd = rd->next) { - if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN))) + for (c = 0, rd = temp_rd ? temp_rd : st->dimensions; rd; c++, rd = rd->next) { + if (unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN))) r->od[c] = RRDR_DIMENSION_HIDDEN; else r->od[c] = RRDR_DIMENSION_DEFAULT; |