From f994482d152694c181cefe585be77c4bb5f5a5bd Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Wed, 22 May 2013 14:13:05 +0200 Subject: [PATCH] Code Review: Avenues for future improvemnet noted. --- storage/metric/memory.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/metric/memory.go b/storage/metric/memory.go index af9ae81c1..130ce6a0b 100644 --- a/storage/metric/memory.go +++ b/storage/metric/memory.go @@ -52,6 +52,8 @@ func (s *stream) add(timestamp time.Time, value model.SampleValue) { s.Lock() defer s.Unlock() + // BUG(all): https://github.com/prometheus/prometheus/pull/265/files#r4336435. + s.values = append(s.values, model.SamplePair{ Timestamp: timestamp, Value: value, @@ -62,6 +64,8 @@ func (s *stream) clone() model.Values { s.RLock() defer s.RUnlock() + // BUG(all): Examine COW technique. + clone := make(model.Values, len(s.values)) copy(clone, s.values) @@ -72,6 +76,7 @@ func (s *stream) getValueAtTime(t time.Time) model.Values { s.RLock() defer s.RUnlock() + // BUG(all): May be avenues for simplification. l := len(s.values) switch l { case 0: