@cryptotaxi247 / netdata-1 / commits / 7bb273184

fix for the spikes at the charts where restarting netdata

Costa Tsaousis (ktsaou) committed Jul 15, 2016 at 21:30 UTC 7bb27318498fb3c481e2d2628e06256f779792d0
1 file changed +12
src/rrd.c
+12
@@ -415,6 +415,8 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const
415 st->entries = entries;
416 st->update_every = update_every;
417
418 + if(st->current_entry >= st->entries) st->current_entry = 0;
419 +
420 strcpy(st->cache_filename, fullfilename);
421 strcpy(st->magic, RRDSET_MAGIC);
422
@@ -571,6 +573,16 @@ RRDDIM *rrddim_add(RRDSET *st, const char *id, const char *name, long multiplier
573
574 // prevent incremental calculation spikes
575 rd->counter = 0;
576 + rd->updated = 0;
577 + rd->calculated_value = 0;
578 + rd->last_calculated_value = 0;
579 + rd->collected_value = 0;
580 + rd->last_collected_value = 0;
581 + rd->collected_volume = 0;
582 + rd->stored_volume = 0;
583 + rd->values[st->current_entry] = pack_storage_number(0, SN_NOT_EXISTS);
584 + rd->last_collected_time.tv_sec = 0;
585 + rd->last_collected_time.tv_usec = 0;
586
587 // append this dimension
588 pthread_rwlock_wrlock(&st->rwlock);