@cryptotaxi247 / netdata-1 / commits / 76a67a833

fixed printing of json data

Costa Tsaousis (ktsaou) committed Apr 16, 2014 at 23:17 UTC 76a67a8335fb25aa6a2a7a1938b226ea53da524f
1 file changed +5 -6
netdata.c
+5 -6
@@ -1104,7 +1104,7 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1104
1105 // temp for the printable values
1106 long double print_values[dimensions];
1107 - int print_enabled[dimensions];
1107 + int print_hidden[dimensions];
1108
1109 // temporary storage to keep track of group values and counts
1110 long double group_values[dimensions];
@@ -1119,9 +1119,9 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1119
1120 for( rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
1121 if(rd->hidden)
1122 - print_enabled[c] = 0;
1122 + print_hidden[c] = 1;
1123 else {
1124 - print_enabled[c] = 1;
1124 + print_hidden[c] = 0;
1125 wb->bytes += sprintf(&wb->buffer[wb->bytes], ",\n {%sid%s:%s%s,%slabel%s:%s%s%s,%spattern%s:%s%s,%stype%s:%snumber%s}", kq, kq, sq, sq, kq, kq, sq, rd->name, sq, kq, kq, sq, sq, kq, kq, sq, sq);
1126 }
1127 }
@@ -1268,10 +1268,9 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1268 wb->bytes += normal_annotation_len;
1269 }
1270
1271 - if(print_enabled[c]) {
1272 - for(c = 0 ; c < dimensions ; c++) {
1271 + for(c = 0 ; c < dimensions ; c++) {
1272 + if(!print_hidden[c])
1273 wb->bytes += sprintf(&wb->buffer[wb->bytes], ",{%sv%s:%0.1Lf}", kq, kq, print_values[c]);
1274 - }
1274 }
1275
1276 printed++;