nil metric list panic fix
This commit is contained in:
@@ -26,6 +26,9 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]string, error)
|
||||
timestamp := metric.UnixNano() / 1000000000
|
||||
|
||||
bucket := s.SerializeBucketName(metric.Name(), metric.Tags())
|
||||
if bucket == "" {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
for fieldName, value := range metric.Fields() {
|
||||
// Convert value to string
|
||||
@@ -89,6 +92,10 @@ func (s *GraphiteSerializer) SerializeBucketName(
|
||||
}
|
||||
}
|
||||
|
||||
if len(out) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if s.Prefix == "" {
|
||||
return sanitizedChars.Replace(strings.Join(out, "."))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user