Skip non-numerical values in graphite format (#3179)
This commit is contained in:
committed by
Daniel Nelson
parent
ef8876b70b
commit
3806424aab
@@ -32,13 +32,16 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]byte, error) {
|
||||
}
|
||||
|
||||
for fieldName, value := range metric.Fields() {
|
||||
// Convert value to string
|
||||
valueS := fmt.Sprintf("%#v", value)
|
||||
point := []byte(fmt.Sprintf("%s %s %d\n",
|
||||
switch value.(type) {
|
||||
case string:
|
||||
continue
|
||||
}
|
||||
metricString := fmt.Sprintf("%s %#v %d\n",
|
||||
// insert "field" section of template
|
||||
sanitizedChars.Replace(InsertField(bucket, fieldName)),
|
||||
sanitizedChars.Replace(valueS),
|
||||
timestamp))
|
||||
value,
|
||||
timestamp)
|
||||
point := []byte(metricString)
|
||||
out = append(out, point...)
|
||||
}
|
||||
return out, nil
|
||||
|
||||
Reference in New Issue
Block a user