Fix export timestamp not working for prometheus on v2 (#7289)

This commit is contained in:
Andrés Álvarez
2020-04-06 22:21:01 +02:00
committed by GitHub
parent c56596dec2
commit df145c7e56
3 changed files with 35 additions and 2 deletions

View File

@@ -43,11 +43,16 @@ type Collector struct {
coll *serializer.Collection
}
func NewCollector(expire time.Duration, stringsAsLabel bool) *Collector {
func NewCollector(expire time.Duration, stringsAsLabel bool, exportTimestamp bool) *Collector {
config := serializer.FormatConfig{}
if stringsAsLabel {
config.StringHandling = serializer.StringAsLabel
}
if exportTimestamp {
config.TimestampExport = serializer.ExportTimestamp
}
return &Collector{
expireDuration: expire,
coll: serializer.NewCollection(config),