mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 04:27:25 +01:00
Enable strings as field values in stdout sink
This commit is contained in:
parent
e8b2bbdae1
commit
b84dc08cd6
@ -27,9 +27,14 @@ func (s *StdoutSink) Write(measurement string, tags map[string]string, fields ma
|
||||
tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
for k, v := range fields {
|
||||
switch v.(type) {
|
||||
case float64:
|
||||
if !math.IsNaN(v.(float64)) {
|
||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64)))
|
||||
}
|
||||
case string:
|
||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%q", k, v.(string)))
|
||||
}
|
||||
}
|
||||
if len(tagsstr) > 0 {
|
||||
fmt.Printf("%s,%s %s %d\n", measurement, strings.Join(tagsstr, ","), strings.Join(fieldstr, ","), t.Unix())
|
||||
|
Loading…
Reference in New Issue
Block a user