mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-24 23:31:02 +02:00
Code Review: Avenues for future improvemnet noted.
This commit is contained in:
parent
298a90c143
commit
f994482d15
@ -52,6 +52,8 @@ func (s *stream) add(timestamp time.Time, value model.SampleValue) {
|
|||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
|
|
||||||
|
// BUG(all): https://github.com/prometheus/prometheus/pull/265/files#r4336435.
|
||||||
|
|
||||||
s.values = append(s.values, model.SamplePair{
|
s.values = append(s.values, model.SamplePair{
|
||||||
Timestamp: timestamp,
|
Timestamp: timestamp,
|
||||||
Value: value,
|
Value: value,
|
||||||
@ -62,6 +64,8 @@ func (s *stream) clone() model.Values {
|
|||||||
s.RLock()
|
s.RLock()
|
||||||
defer s.RUnlock()
|
defer s.RUnlock()
|
||||||
|
|
||||||
|
// BUG(all): Examine COW technique.
|
||||||
|
|
||||||
clone := make(model.Values, len(s.values))
|
clone := make(model.Values, len(s.values))
|
||||||
copy(clone, s.values)
|
copy(clone, s.values)
|
||||||
|
|
||||||
@ -72,6 +76,7 @@ func (s *stream) getValueAtTime(t time.Time) model.Values {
|
|||||||
s.RLock()
|
s.RLock()
|
||||||
defer s.RUnlock()
|
defer s.RUnlock()
|
||||||
|
|
||||||
|
// BUG(all): May be avenues for simplification.
|
||||||
l := len(s.values)
|
l := len(s.values)
|
||||||
switch l {
|
switch l {
|
||||||
case 0:
|
case 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user