diff --git a/storage/local/series.go b/storage/local/series.go index f17a92b3e..75545830d 100644 --- a/storage/local/series.go +++ b/storage/local/series.go @@ -288,7 +288,7 @@ func (s *memorySeries) maybeCloseHeadChunk() bool { func (s *memorySeries) evictChunkDescs(iOldestNotEvicted int) { lenToKeep := chunkDescEvictionFactor * (len(s.chunkDescs) - iOldestNotEvicted) if lenToKeep < len(s.chunkDescs) { - s.savedFirstTime = s.FirstTime() + s.savedFirstTime = s.firstTime() lenEvicted := len(s.chunkDescs) - lenToKeep s.chunkDescsOffset += lenEvicted s.persistWatermark -= lenEvicted @@ -514,7 +514,7 @@ func (s *memorySeries) head() *chunk.Desc { // firstTime returns the timestamp of the first sample in the series. // // The caller must have locked the fingerprint of the memorySeries. -func (s *memorySeries) FirstTime() model.Time { +func (s *memorySeries) firstTime() model.Time { if s.chunkDescsOffset == 0 && len(s.chunkDescs) > 0 { return s.chunkDescs[0].FirstTime() } diff --git a/storage/local/storage.go b/storage/local/storage.go index 72332bad1..10b825adb 100644 --- a/storage/local/storage.go +++ b/storage/local/storage.go @@ -657,7 +657,7 @@ func (s *MemorySeriesStorage) metricForRange( ) (model.Metric, *memorySeries, bool) { series, ok := s.fpToSeries.get(fp) if ok { - if series.lastTime.Before(from) || series.FirstTime().After(through) { + if series.lastTime.Before(from) || series.firstTime().After(through) { return nil, nil, false } return series.metric, series, true @@ -1264,7 +1264,7 @@ func (s *MemorySeriesStorage) maintainMemorySeries( if iOldestNotEvicted == -1 && model.Now().Sub(series.lastTime) > headChunkTimeout { s.fpToSeries.del(fp) s.numSeries.Dec() - s.persistence.archiveMetric(fp, series.metric, series.FirstTime(), series.lastTime) + s.persistence.archiveMetric(fp, series.metric, series.firstTime(), series.lastTime) s.seriesOps.WithLabelValues(archive).Inc() oldWatermark := atomic.LoadInt64((*int64)(&s.archiveHighWatermark)) if oldWatermark < int64(series.lastTime) { @@ -1325,7 +1325,7 @@ func (s *MemorySeriesStorage) writeMemorySeries( chunks[i] = cd.C } - if !series.FirstTime().Before(beforeTime) { + if !series.firstTime().Before(beforeTime) { // Oldest sample not old enough, just append chunks, if any. if len(cds) == 0 { return false diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go index 73804fedc..9507da342 100644 --- a/storage/local/storage_test.go +++ b/storage/local/storage_test.go @@ -69,7 +69,7 @@ func TestMatches(t *testing.T) { t.Fatal("could not retrieve series for fp", fp) } storage.fpLocker.Lock(fp) - storage.persistence.archiveMetric(fp, s.metric, s.FirstTime(), s.lastTime) + storage.persistence.archiveMetric(fp, s.metric, s.firstTime(), s.lastTime) storage.fpLocker.Unlock(fp) } @@ -1276,7 +1276,7 @@ func testEvictAndPurgeSeries(t *testing.T, encoding chunk.Encoding) { if err != nil { t.Fatal(err) } - s.persistence.archiveMetric(fp, series.metric, series.FirstTime(), lastTime) + s.persistence.archiveMetric(fp, series.metric, series.firstTime(), lastTime) archived, _, _ := s.persistence.hasArchivedMetric(fp) if !archived { t.Fatal("not archived") @@ -1317,7 +1317,7 @@ func testEvictAndPurgeSeries(t *testing.T, encoding chunk.Encoding) { if err != nil { t.Fatal(err) } - s.persistence.archiveMetric(fp, series.metric, series.FirstTime(), lastTime) + s.persistence.archiveMetric(fp, series.metric, series.firstTime(), lastTime) archived, _, _ = s.persistence.hasArchivedMetric(fp) if !archived { t.Fatal("not archived")