fixed gauge private chart updates
Costa Tsaousis (ktsaou) committed
May 4, 2017 at 00:55 UTC
9a99d0acb112017394b3c13c1b5f7bdebb6a171b
1 file changed
+6
-9
src/statsd.c
+6
-9
@@ -1389,11 +1389,12 @@ static inline void statsd_flush_gauge(STATSD_METRIC *m) {
1389
debug(D_STATSD, "flushing gauge metric '%s'", m->name);
1390
1391
int updated = 0;
1392
+ if(m->count && !m->reset) {
1393
+ m->last = (collected_number) (m->gauge.value * 1000.0);
1394
1393
- if(m->count && !m->reset)
1394
- m->last = (collected_number )(m->gauge.value * 1000.0);
1395
-
1396
- m->reset = 1;
1395
+ m->reset = 1;
1396
+ updated = 1;
1397
+ }
1398
1399
if(m->options & STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED && (updated || !(m->options & STATSD_METRIC_OPTION_SHOW_GAPS_WHEN_NOT_COLLECTED)))
1400
statsd_private_chart_gauge(m);
@@ -1403,7 +1404,6 @@ static inline void statsd_flush_counter_or_meter(STATSD_METRIC *m, const char *d
1404
debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1405
1406
int updated = 0;
1406
-
1407
if(m->count && !m->reset) {
1408
m->last = m->counter.value;
1409
@@ -1415,7 +1415,6 @@ static inline void statsd_flush_counter_or_meter(STATSD_METRIC *m, const char *d
1415
statsd_private_chart_counter_or_meter(m, dim, family);
1416
}
1417
1418
-
1418
static inline void statsd_flush_counter(STATSD_METRIC *m) {
1419
statsd_flush_counter_or_meter(m, "counter", "counters");
1420
}
@@ -1428,7 +1427,6 @@ static inline void statsd_flush_set(STATSD_METRIC *m) {
1427
debug(D_STATSD, "flushing set metric '%s'", m->name);
1428
1429
int updated = 0;
1431
-
1430
if(m->count && !m->reset) {
1431
m->last = m->set.unique;
1432
@@ -1443,10 +1441,9 @@ static inline void statsd_flush_set(STATSD_METRIC *m) {
1441
static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char *dim, const char *family, const char *units) {
1442
debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
1443
1446
- int updated = 0;
1447
-
1444
netdata_mutex_lock(&m->histogram.mutex);
1445
1446
+ int updated = 0;
1447
if(m->count && !m->reset) {
1448
size_t len = m->histogram.ext->used;
1449
long double *series = m->histogram.ext->values;