do not overwrite discard_reason
Costa Tsaousis (ktsaou) committed
Jul 18, 2018 at 03:03 UTC
d706bcdd0e6b78891dc22b8e1c8b90325cd56b30
1 file changed
+7
-7
src/rrdset.c
+7
-7
@@ -727,7 +727,7 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
727
now_realtime_timeval(&now);
728
729
#ifdef NETDATA_INTERNAL_CHECKS
730
- char *discard_reason = "UNDEFINED";
730
+ char *discard_reason = NULL;
731
usec_t discarded = microseconds;
732
#endif
733
@@ -739,7 +739,7 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
739
microseconds = 0;
740
741
#ifdef NETDATA_INTERNAL_CHECKS
742
- discard_reason = "SYNC CLOCK FLAG";
742
+ if(!discard_reason) discard_reason = "SYNC CLOCK FLAG";
743
#endif
744
}
745
@@ -747,14 +747,14 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
747
// the first entry
748
microseconds = st->update_every * USEC_PER_SEC;
749
#ifdef NETDATA_INTERNAL_CHECKS
750
- discard_reason = "FIRST DATA COLLECTION";
750
+ if(!discard_reason) discard_reason = "FIRST DATA COLLECTION";
751
#endif
752
}
753
else if(unlikely(!microseconds)) {
754
// no dt given by the plugin
755
microseconds = dt_usec(&now, &st->last_collected_time);
756
#ifdef NETDATA_INTERNAL_CHECKS
757
- discard_reason = "NO USEC GIVEN BY COLLECTOR";
757
+ if(!discard_reason) discard_reason = "NO USEC GIVEN BY COLLECTOR";
758
#endif
759
}
760
else {
@@ -775,7 +775,7 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
775
776
microseconds = st->update_every * USEC_PER_SEC;
777
#ifdef NETDATA_INTERNAL_CHECKS
778
- discard_reason = "COLLECTION TIME IN FUTURE";
778
+ if(!discard_reason) discard_reason = "COLLECTION TIME IN FUTURE";
779
#endif
780
}
781
else if(unlikely((usec_t)since_last_usec > (usec_t)(st->update_every * 5 * USEC_PER_SEC))) {
@@ -784,7 +784,7 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
784
785
microseconds = (usec_t)since_last_usec;
786
#ifdef NETDATA_INTERNAL_CHECKS
787
- discard_reason = "COLLECTION TIME TOO FAR IN THE PAST";
787
+ if(!discard_reason) discard_reason = "COLLECTION TIME TOO FAR IN THE PAST";
788
#endif
789
}
790
@@ -818,7 +818,7 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
818
rrdset_debug(st, "NEXT: %llu microseconds", microseconds);
819
820
if(discarded && discarded != microseconds)
821
- info("host '%s', chart '%s': discarded data collection time of %llu usec, replaced with %llu usec, reason: '%s'", st->rrdhost->hostname, st->id, discarded, microseconds, discard_reason);
821
+ info("host '%s', chart '%s': discarded data collection time of %llu usec, replaced with %llu usec, reason: '%s'", st->rrdhost->hostname, st->id, discarded, microseconds, discard_reason?discard_reason:"UNDEFINED");
822
823
#endif
824