summaryrefslogtreecommitdiffstats
path: root/web/api/queries/average/average.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-03 10:23:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-09-03 10:23:38 +0000
commit574098461cd45be12a497afbdac6f93c58978387 (patch)
tree9eb60a5930b7c20d42f7fde1e234cae3968ed3d9 /web/api/queries/average/average.c
parentAdding upstream version 1.16.1. (diff)
downloadnetdata-574098461cd45be12a497afbdac6f93c58978387.tar.xz
netdata-574098461cd45be12a497afbdac6f93c58978387.zip
Adding upstream version 1.17.0.upstream/1.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/queries/average/average.c')
-rw-r--r--web/api/queries/average/average.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/web/api/queries/average/average.c b/web/api/queries/average/average.c
index c871b8778..2c64358e6 100644
--- a/web/api/queries/average/average.c
+++ b/web/api/queries/average/average.c
@@ -46,9 +46,12 @@ calculated_number grouping_flush_average(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_
*rrdr_value_options_ptr |= RRDR_VALUE_EMPTY;
}
else {
- if(unlikely(r->internal.resampling_group != 1))
- value = g->sum / r->internal.resampling_divisor;
- else
+ if(unlikely(r->internal.resampling_group != 1)) {
+ if (unlikely(r->result_options & RRDR_RESULT_OPTION_VARIABLE_STEP))
+ value = g->sum / g->count / r->internal.resampling_divisor;
+ else
+ value = g->sum / r->internal.resampling_divisor;
+ } else
value = g->sum / g->count;
}