mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 07:29:04 +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))
|
tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", k, v))
|
||||||
}
|
}
|
||||||
for k, v := range fields {
|
for k, v := range fields {
|
||||||
if !math.IsNaN(v.(float64)) {
|
switch v.(type) {
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", k, v.(float64)))
|
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 {
|
if len(tagsstr) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user