Merge pull request #2295 from prometheus/fast-path-remote
Don't clone the metric if there's no remote writes.
This commit is contained in:
commit
d6d03a966f
|
@ -77,6 +77,10 @@ func (s *ReloadableStorage) Append(smpl *model.Sample) error {
|
|||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
|
||||
if s.queue == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var snew model.Sample
|
||||
snew = *smpl
|
||||
snew.Metric = smpl.Metric.Clone()
|
||||
|
@ -92,9 +96,7 @@ func (s *ReloadableStorage) Append(smpl *model.Sample) error {
|
|||
if snew.Metric == nil {
|
||||
return nil
|
||||
}
|
||||
if s.queue != nil {
|
||||
s.queue.Append(&snew)
|
||||
}
|
||||
s.queue.Append(&snew)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue