diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-07-18 02:07:46 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-07-18 02:07:46 +0300 |
commit | 0b50eae1c052ccf509b5a05e3de659aa6b062c1b (patch) | |
tree | 124507160fea77648ad32cb83a940d65c74980ba /src | |
parent | 546ab2539b57a6079a50b6730f945a34254f234c (diff) |
sync chart clock, when the definition of the chart is sent to netdata
Diffstat (limited to 'src')
-rw-r--r-- | src/rrd.h | 1 | ||||
-rw-r--r-- | src/rrdset.c | 5 |
2 files changed, 5 insertions, 1 deletions
@@ -235,6 +235,7 @@ typedef enum rrdset_flags { RRDSET_FLAG_HETEROGENEOUS = 1 << 8, // if set, the chart is not homogeneous (dimensions in it have multiple algorithms, multipliers or dividers) RRDSET_FLAG_HOMEGENEOUS_CHECK= 1 << 9, // if set, the chart should be checked to determine if the dimensions as homogeneous RRDSET_FLAG_HIDDEN = 1 << 10, // if set, do not show this chart on the dashboard, but use it for backends + RRDSET_FLAG_SYNC_CLOCK = 1 << 11, // if set, microseconds on next data collection will be ignored (the chart will be synced to now) } RRDSET_FLAGS; #ifdef HAVE_C___ATOMIC diff --git a/src/rrdset.c b/src/rrdset.c index b3e56aa4d7..038be2ee67 100644 --- a/src/rrdset.c +++ b/src/rrdset.c @@ -484,6 +484,7 @@ RRDSET *rrdset_create_custom( st = rrdset_find_on_create(host, fullid); if(st) { rrdhost_unlock(host); + rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK); return st; } @@ -646,6 +647,7 @@ RRDSET *rrdset_create_custom( rrdset_flag_clear(st, RRDSET_FLAG_DEBUG); rrdset_flag_clear(st, RRDSET_FLAG_OBSOLETE); rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM); + rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK); // if(!strcmp(st->id, "disk_util.dm-0")) { // st->debug = 1; @@ -728,9 +730,10 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) { // the first entry microseconds = st->update_every * USEC_PER_SEC; } - else if(unlikely(!microseconds)) { + else if(unlikely(!microseconds || rrdset_flag_check(st, RRDSET_FLAG_SYNC_CLOCK))) { // no dt given by the plugin microseconds = dt_usec(&now, &st->last_collected_time); + rrdset_flag_clear(st, RRDSET_FLAG_SYNC_CLOCK); } else { // microseconds has the time since the last collection |