From 20ad403587f425fb509f39dcf45445afb0908f6b Mon Sep 17 00:00:00 2001 From: Laurie Malau Date: Sun, 9 Aug 2015 22:43:31 +0200 Subject: [PATCH] Don't warn/increment metric upon equal timestamps during append. Perhaps it would be even better to still warn in case the sample value has changed but the timestamps are equal, but we don't have efficient access to the last value. --- storage/local/storage.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/local/storage.go b/storage/local/storage.go index 7ff73107bc..8d8cb54bc0 100644 --- a/storage/local/storage.go +++ b/storage/local/storage.go @@ -560,9 +560,15 @@ func (s *memorySeriesStorage) Append(sample *clientmodel.Sample) { series := s.getOrCreateSeries(fp, sample.Metric) if sample.Timestamp <= series.lastTime { + // Don't log and track equal timestamps, as they are a common occurrence + // when using client-side timestamps (e.g. Pushgateway or federation). + // It would be even better to also compare the sample values here, but + // we don't have efficient access to a series's last value. + if sample.Timestamp != series.lastTime { + log.Warnf("Ignoring sample with out-of-order timestamp for fingerprint %v (%v): %v is not after %v", fp, series.metric, sample.Timestamp, series.lastTime) + s.outOfOrderSamplesCount.Inc() + } s.fpLocker.Unlock(fp) - log.Warnf("Ignoring sample with out-of-order timestamp for fingerprint %v (%v): %v is not after %v", fp, series.metric, sample.Timestamp, series.lastTime) - s.outOfOrderSamplesCount.Inc() return } completedChunksCount := series.add(&metric.SamplePair{