From: Costa Tsaousis (ktsaou) Date: Mon, 14 Nov 2016 22:05:25 +0000 (+0200) Subject: move core iteration point in the middle of the second, to give some tollerance to... X-Git-Tag: v1.5.0~182^2~3 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=f01aeea73a6dc2fbf2ad873b89402653b97b9fef;p=netdata.git move core iteration point in the middle of the second, to give some tollerance to plugins --- diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index 4ab9de4c..9d428492 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -148,7 +148,7 @@ class SimpleService(threading.Thread): self.debug("starting data collection - update frequency:", str(step), ", retries allowed:", str(self.retries)) while True: # run forever, unless something is wrong now = float(time.time()) - next = self.timetable['next'] = now - (now % step) + step + (step / 3) # add 1/3 into the iteration to sync with netdata + next = self.timetable['next'] = now - (now % step) + step # it is important to do this in a loop # sleep() is interruptable diff --git a/src/log.c b/src/log.c index bf2ad6b3..dc008342 100644 --- a/src/log.c +++ b/src/log.c @@ -125,7 +125,11 @@ int error_log_limit(int reset) { // prevent all logs if the errors per period is 0 if(error_log_errors_per_period == 0) +#ifdef NETDATA_INTERNAL_CHECKS + return 0; +#else return 1; +#endif time_t now = time(NULL); if(!start) start = now; @@ -185,7 +189,11 @@ int error_log_limit(int reset) { prevented++; // prevent logging this error +#ifdef NETDATA_INTERNAL_CHECKS + return 0; +#else return 1; +#endif } return 0; diff --git a/src/rrd.c b/src/rrd.c index 7d8bf394..2639d926 100644 --- a/src/rrd.c +++ b/src/rrd.c @@ -527,9 +527,12 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const } // make sure the database is aligned - if(st->last_updated.tv_sec % update_every) { - st->last_updated.tv_sec -= st->last_updated.tv_sec % update_every; - st->last_updated.tv_usec = 0; + if(st->last_updated.tv_sec) { + if(st->last_updated.tv_sec % update_every) + st->last_updated.tv_sec -= st->last_updated.tv_sec % update_every; + + // aligned in the middle, for tolerance with plugins + st->last_updated.tv_usec = 500000ULL; } } @@ -1103,7 +1106,7 @@ unsigned long long rrdset_done(RRDSET *st) // align it to update_every st->last_collected_time.tv_sec -= st->last_collected_time.tv_sec % st->update_every; - st->last_collected_time.tv_usec = 0; + st->last_collected_time.tv_usec = 500000ULL; last_collect_ut = st->last_collected_time.tv_sec * 1000000ULL + st->last_collected_time.tv_usec - update_every_ut; @@ -1149,7 +1152,7 @@ unsigned long long rrdset_done(RRDSET *st) // align it to update_every st->last_collected_time.tv_sec -= st->last_collected_time.tv_sec % st->update_every; - st->last_collected_time.tv_usec = 0; + st->last_collected_time.tv_usec = 500000ULL; unsigned long long ut = st->last_collected_time.tv_sec * 1000000ULL + st->last_collected_time.tv_usec - st->usec_since_last_update; st->last_updated.tv_sec = (time_t) (ut / 1000000ULL);