From: Costa Tsaousis Date: Sat, 28 Jan 2017 01:29:42 +0000 (+0200) Subject: Merge pull request #1662 from ktsaou/master X-Git-Tag: ab-debian_0.20170201.01-0ab1~19 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=b87bb0dd29c29fbc8760eaafc3e668fde94b35d9;hp=5f2abc57883d4a0d4a89b3ae834d7a922bab31df;p=netdata.git Merge pull request #1662 from ktsaou/master fix: nonzero option should return all selected dimensions if they are all zero --- diff --git a/configs.signatures b/configs.signatures index 817c3890..9a435dfc 100644 --- a/configs.signatures +++ b/configs.signatures @@ -168,6 +168,7 @@ declare -A configs_signatures=( ['6b39de5d85db45115db236347a6896d4']='health.d/named.conf' ['6b917300747e7e8314844237e2462261']='python.d/apache_cache.conf' ['6bf0de6e3b251b765b10a71d8c5c319d']='python.d/apache.conf' + ['6c9f2f0abe49a6f1a69db052ebcef1bf']='python.d/elasticsearch.conf' ['6ca08ea2a238cad26578b8b85edae160']='health.d/udp_errors.conf' ['6cba40e32a7e98a98c31a209913839cc']='python.d/nginx_log.conf' ['6d02c2dd0863e09ad9dbba53e3b58116']='health.d/mysql.conf' @@ -372,6 +373,7 @@ declare -A configs_signatures=( ['f82924563e41d99cdae5431f0af69155']='python.d.conf' ['f8c30f22df92765e2c0fab3c8174e2fc']='health.d/memcached.conf' ['f8dade4484f1b6a48655388502df7d5a']='health_alarm_notify.conf' + ['f96acba4b14b0c1b50d0187a04416151']='health_alarm_notify.conf' ['f9be549a849d023595d19d5d74263e0f']='health.d/tcp_resets.conf' ['fa4396513b358d6ec6a7f5bfb08439b8']='health.d/net.conf' ['fd3164e6e8cb6726706267eae49aa082']='health_alarm_notify.conf' diff --git a/src/rrd2json.c b/src/rrd2json.c index 65346f31..aa07b6fc 100644 --- a/src/rrd2json.c +++ b/src/rrd2json.c @@ -449,6 +449,7 @@ void rrd_stats_all_json(BUFFER *wb) #define RRDR_RESET 0x02 // the dimension contains / the value is reset #define RRDR_HIDDEN 0x04 // the dimension contains / the value is hidden #define RRDR_NONZERO 0x08 // the dimension contains / the value is non-zero +#define RRDR_SELECTED 0x10 // the dimension is selected // RRDR result options #define RRDR_RESULT_OPTION_ABSOLUTE 0x00000001 @@ -564,13 +565,12 @@ void rrdr_disable_not_selected_dimensions(RRDR *r, uint32_t options, const char // find it and enable it for(c = 0, d = r->st->dimensions; d ;c++, d = d->next) { if(unlikely((hash == d->hash && !strcmp(d->id, tok)) || !strcmp(d->name, tok))) { - dims_selected++; - r->od[c] |= RRDR_OPTION_SELECTED; - - // remove the hidden flag, if it is set - if(likely(r->od[c] & RRDR_HIDDEN)) + if(likely(r->od[c] & RRDR_HIDDEN)) { + r->od[c] |= RRDR_SELECTED; r->od[c] &= ~RRDR_HIDDEN; + dims_selected++; + } // since the user needs this dimension // make it appear as NONZERO, to return it @@ -593,7 +593,7 @@ void rrdr_disable_not_selected_dimensions(RRDR *r, uint32_t options, const char // enable the selected ones // to avoid returning an empty chart for(c = 0, d = r->st->dimensions; d ;c++, d = d->next) - if(unlikely(r->od[c] & RRDR_OPTION_SELECTED)) + if(unlikely(r->od[c] & RRDR_SELECTED)) r->od[c] |= RRDR_NONZERO; } } diff --git a/src/rrd2json.h b/src/rrd2json.h index de82de43..7b140197 100644 --- a/src/rrd2json.h +++ b/src/rrd2json.h @@ -57,7 +57,6 @@ #define RRDR_OPTION_LABEL_QUOTES 0x00000400 // in CSV output, wrap header labels in double quotes #define RRDR_OPTION_PERCENTAGE 0x00000800 // give values as percentage of total #define RRDR_OPTION_NOT_ALIGNED 0x00001000 // do not align charts for persistant timeframes -#define RRDR_OPTION_SELECTED 0x00002000 // the dimension is selected by the caller: rrdr_disable_not_selected_dimensions() extern void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb); extern void rrd_stats_api_v1_charts(BUFFER *wb);