]> arthur.barton.de Git - netdata.git/commitdiff
move core iteration point in the middle of the second, to give some tollerance to...
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 14 Nov 2016 22:05:25 +0000 (00:05 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 14 Nov 2016 22:05:25 +0000 (00:05 +0200)
python.d/python_modules/base.py
src/log.c
src/rrd.c

index 4ab9de4cfd873542b1fd0e46e8ba77b8621f31f3..9d428492c7a37697be809af3fe3dab079a25eb4e 100644 (file)
@@ -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
index bf2ad6b381fb6531f0f436ebe86411451c1e9074..dc00834236bf982dac79a5232614fa36260a5505 100644 (file)
--- 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;
index 7d8bf3940b9502e8710b7a1d901312f267068adb..2639d92627a1f16e5528a4dd3dd72f780f9ef79f 100644 (file)
--- 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);