@cryptotaxi247 / netdata-1 / commits / 48b1161d5

do not convert to percentage, when the raw option is given (#14969)

Costa Tsaousis committed Apr 26, 2023 at 19:09 UTC 48b1161d505098d7bb3d6927f04c5806b2d74b6a
2 files changed +6 -3
database/contexts/rrdcontext.h
+5 -2
@@ -540,10 +540,13 @@ static inline bool query_target_needs_all_dimensions(QUERY_TARGET *qt) {
540 }
541
542 static inline bool query_target_has_percentage_units(QUERY_TARGET *qt) {
543 - if(qt->window.time_group_method == RRDR_GROUPING_CV || query_target_needs_all_dimensions(qt))
543 + if(qt->window.time_group_method == RRDR_GROUPING_CV)
544 return true;
545
546 - return false;
546 + if((qt->request.options & RRDR_OPTION_PERCENTAGE) && !(qt->window.options & RRDR_OPTION_RETURN_RAW))
547 + return true;
548 +
549 + return query_target_has_percentage_of_instance(qt);
550 }
551
552 #endif // NETDATA_RRDCONTEXT_H
web/api/queries/query.c
+1 -1
@@ -3416,7 +3416,7 @@ static RRDR *rrd2rrdr_group_by_finalize(RRDR *r_tmp) {
3416 qt->window.options &= ~RRDR_OPTION_NONZERO;
3417 }
3418
3419 - if(options & RRDR_OPTION_PERCENTAGE)
3419 + if(options & RRDR_OPTION_PERCENTAGE && !(options & RRDR_OPTION_RETURN_RAW))
3420 rrd2rrdr_convert_to_percentage(r);
3421
3422 // update query instance counts in query host and query context