Use add time for prometheus expiration calculation (#7056)

This commit is contained in:
Daniel Nelson
2020-02-24 15:53:16 -08:00
committed by GitHub
parent e9e4f2c354
commit b5e0577d6b
4 changed files with 266 additions and 179 deletions

View File

@@ -2,6 +2,7 @@ package prometheus
import (
"bytes"
"time"
"github.com/influxdata/telegraf"
"github.com/prometheus/common/expfmt"
@@ -53,7 +54,7 @@ func (s *Serializer) Serialize(metric telegraf.Metric) ([]byte, error) {
func (s *Serializer) SerializeBatch(metrics []telegraf.Metric) ([]byte, error) {
coll := NewCollection(s.config)
for _, metric := range metrics {
coll.Add(metric)
coll.Add(metric, time.Now())
}
var buf bytes.Buffer