[fix] name_prefix invalid to prometheus sample
This commit is contained in:
parent
efdbf5c5e6
commit
fe549740ae
|
@ -64,10 +64,6 @@ func NewSamples(fields map[string]interface{}, labels ...map[string]string) []*t
|
|||
|
||||
func PushSamples(slist *list.SafeList, fields map[string]interface{}, labels ...map[string]string) {
|
||||
for metric, value := range fields {
|
||||
floatValue, err := conv.ToFloat64(value)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
slist.PushFront(NewSample(metric, floatValue, labels...))
|
||||
slist.PushFront(NewSample(metric, value, labels...))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package prometheus
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"flashcat.cloud/categraf/pkg/conv"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
@ -116,11 +115,7 @@ func (p *Parser) handleHistogram(m *dto.Metric, tags map[string]string, metricNa
|
|||
func (p *Parser) handleSample(m *dto.Metric, tags map[string]string, metricName string, slist *list.SafeList) {
|
||||
fields := getNameAndValue(m, metricName)
|
||||
for metric, value := range fields {
|
||||
floatValue, err := conv.ToFloat64(value)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
slist.PushFront(inputs.NewSample(prom.BuildMetric(p.NamePrefix, metric, ""), floatValue, tags))
|
||||
slist.PushFront(inputs.NewSample(prom.BuildMetric(p.NamePrefix, metric, ""), value, tags))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue