From 5d88e8cc45e18432b62ca5b1497f6efcd744759f Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Tue, 16 Jul 2013 14:38:11 +0200 Subject: [PATCH] Round time to nearest second in memory storage. When samples get flushed to disk, they lose sub-second precision anyways. By already dropping sub-second precision, data fetched from memory vs. disk will behave the same. Later, we should consider also storing a more compact representation than time.Time in memory if we're not going to use its full precision. --- storage/metric/memory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/metric/memory.go b/storage/metric/memory.go index 564201467..a43f53be5 100644 --- a/storage/metric/memory.go +++ b/storage/metric/memory.go @@ -55,7 +55,7 @@ func (s *stream) add(timestamp time.Time, value clientmodel.SampleValue) { // BUG(all): https://github.com/prometheus/prometheus/pull/265/files#r4336435. s.values = append(s.values, &SamplePair{ - Timestamp: timestamp, + Timestamp: timestamp.Round(time.Second).UTC(), Value: value, }) }