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:
Fabian Reinartz 2016-12-21 12:36:41 +01:00 committed by GitHub
commit d6d03a966f
1 changed files with 5 additions and 3 deletions

View File

@ -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)
}
return nil
}