]> arthur.barton.de Git - netdata.git/blobdiff - src/rrd2json.c
varnish plugin: now uses PATH env variable to find varnishstat binary
[netdata.git] / src / rrd2json.c
index 65346f31e732010b21fd1499d20a228c8c7e6de5..4bbf61e8db8a87f5bbf4d5cd1bb1e505cbd9c4bd 100644 (file)
@@ -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;
     }
 }
@@ -2305,7 +2305,7 @@ time_t rrd_stats_json(int type, RRDSET *st, BUFFER *wb, long points, long group,
 
     } // max_loop
 
-    debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %lu bytes", st->name, wb->len);
+    debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %zu bytes", st->name, wb->len);
 
     pthread_rwlock_unlock(&st->rwlock);
     return last_timestamp;