sync chart clock, when the definition of the chart is sent to netdata
Costa Tsaousis (ktsaou) committed
Jul 18, 2018 at 02:07 UTC
0b50eae1c052ccf509b5a05e3de659aa6b062c1b
2 files changed
+5
-1
src/rrd.h
+1
@@ -235,6 +235,7 @@ typedef enum rrdset_flags {
235
RRDSET_FLAG_HETEROGENEOUS = 1 << 8, // if set, the chart is not homogeneous (dimensions in it have multiple algorithms, multipliers or dividers)
236
RRDSET_FLAG_HOMEGENEOUS_CHECK= 1 << 9, // if set, the chart should be checked to determine if the dimensions as homogeneous
237
RRDSET_FLAG_HIDDEN = 1 << 10, // if set, do not show this chart on the dashboard, but use it for backends
238
+ RRDSET_FLAG_SYNC_CLOCK = 1 << 11, // if set, microseconds on next data collection will be ignored (the chart will be synced to now)
239
} RRDSET_FLAGS;
240
241
#ifdef HAVE_C___ATOMIC
src/rrdset.c
+4
-1
@@ -484,6 +484,7 @@ RRDSET *rrdset_create_custom(
484
st = rrdset_find_on_create(host, fullid);
485
if(st) {
486
rrdhost_unlock(host);
487
+ rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK);
488
return st;
489
}
490
@@ -646,6 +647,7 @@ RRDSET *rrdset_create_custom(
647
rrdset_flag_clear(st, RRDSET_FLAG_DEBUG);
648
rrdset_flag_clear(st, RRDSET_FLAG_OBSOLETE);
649
rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
650
+ rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK);
651
652
// if(!strcmp(st->id, "disk_util.dm-0")) {
653
// st->debug = 1;
@@ -728,9 +730,10 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
730
// the first entry
731
microseconds = st->update_every * USEC_PER_SEC;
732
}
731
- else if(unlikely(!microseconds)) {
733
+ else if(unlikely(!microseconds || rrdset_flag_check(st, RRDSET_FLAG_SYNC_CLOCK))) {
734
// no dt given by the plugin
735
microseconds = dt_usec(&now, &st->last_collected_time);
736
+ rrdset_flag_clear(st, RRDSET_FLAG_SYNC_CLOCK);
737
}
738
else {
739
// microseconds has the time since the last collection