mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 15:09:05 +01:00
Enable strings as field values in stdout sink
This commit is contained in:
parent
e8b2bbdae1
commit
b84dc08cd6
@ -27,8 +27,13 @@ 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 {
|
||||
if !math.IsNaN(v.(float64)) {
|
||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64)))
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user