Convert bool fields to int in graphite serializer

This commit is contained in:
Daniel Nelson
2017-08-29 16:22:03 -07:00
parent 3806424aab
commit 8225bd0173
3 changed files with 37 additions and 2 deletions

View File

@@ -32,9 +32,15 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]byte, error) {
}
for fieldName, value := range metric.Fields() {
switch value.(type) {
switch v := value.(type) {
case string:
continue
case bool:
if v {
value = 1
} else {
value = 0
}
}
metricString := fmt.Sprintf("%s %#v %d\n",
// insert "field" section of template