@cryptotaxi247 / netdata-1 / commits / d984dd4b0

timing issues are logged as errors only when NETDATA_INTERNAL_CHECKS is defined

Costa Tsaousis (ktsaou) committed Nov 7, 2016 at 23:22 UTC d984dd4b0c1fc607138c068e241cd6d63544d550
1 file changed +11 -5
src/rrd.c
+11 -5
@@ -1004,15 +1004,21 @@ void rrdset_next_usec(RRDSET *st, unsigned long long microseconds)
1004
1005 // verify the microseconds given is good
1006 if(unlikely(last_usec + microseconds > now_usec)) {
1007 - debug(D_RRD_CALLS, "rrdset_next_usec() for chart %s with dt %llu is %llu usec to the future", st->name, microseconds, last_usec + microseconds - now_usec);
1007 + debug(D_RRD_CALLS, "dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, last_usec + microseconds - now_usec, st->name, st->id);
1008
1009 - if(unlikely(last_usec + microseconds > now_usec + 10000))
1010 - error("Invalid dt %llu usec given - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, last_usec + microseconds - now_usec, st->name, st->id);
1009 +#ifdef NETDATA_INTERNAL_CHECKS
1010 + if(unlikely(last_usec + microseconds > now_usec + 1000))
1011 + error("dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, last_usec + microseconds - now_usec, st->name, st->id);
1012 +#endif
1013
1014 microseconds = since_last_usec;
1015 }
1014 - else if(unlikely(microseconds < since_last_usec * 0.2 || microseconds > since_last_usec * 1.2)) {
1015 - error("Invalid dt %llu usec given - expected %llu usec +/- 20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1016 + else if(unlikely(microseconds < since_last_usec * 0.8 || microseconds > since_last_usec * 1.2)) {
1017 + debug(D_RRD_CALLS, "dt %llu usec given is wrong - expected %llu usec +/- 20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1018 +
1019 +#ifdef NETDATA_INTERNAL_CHECKS
1020 + error("dt %llu usec given is wrong - expected %llu usec +/- 20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1021 +#endif
1022 microseconds = since_last_usec;
1023 }
1024 }