mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 07:29:04 +01:00
Replace FieldList() by Fields()
This commit is contained in:
parent
fe42e8bb95
commit
af051b5e7e
@ -146,8 +146,8 @@ func getParamMap(point lp.CCMetric) map[string]interface{} {
|
|||||||
for key, value := range point.Meta() {
|
for key, value := range point.Meta() {
|
||||||
params[key] = value
|
params[key] = value
|
||||||
}
|
}
|
||||||
for _, f := range point.FieldList() {
|
for key, value := range point.Fields() {
|
||||||
params[f.Key] = f.Value
|
params[key] = value
|
||||||
}
|
}
|
||||||
params["timestamp"] = point.Time()
|
params["timestamp"] = point.Time()
|
||||||
return params
|
return params
|
||||||
|
@ -59,28 +59,28 @@ func (s *StdoutSink) Write(point lp.CCMetric) error {
|
|||||||
tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", m.Key, m.Value))
|
tagsstr = append(tagsstr, fmt.Sprintf("%s=%s", m.Key, m.Value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, f := range point.FieldList() {
|
for key, value := range point.Fields() {
|
||||||
switch f.Value.(type) {
|
switch value.(type) {
|
||||||
case float64:
|
case float64:
|
||||||
if !math.IsNaN(f.Value.(float64)) {
|
if !math.IsNaN(value.(float64)) {
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", f.Key, f.Value.(float64)))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", key, value.(float64)))
|
||||||
} else {
|
} else {
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=0.0", f.Key))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=0.0", key))
|
||||||
}
|
}
|
||||||
case float32:
|
case float32:
|
||||||
if !math.IsNaN(float64(f.Value.(float32))) {
|
if !math.IsNaN(float64(value.(float32))) {
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", f.Key, f.Value.(float32)))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", key, value.(float32)))
|
||||||
} else {
|
} else {
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=0.0", f.Key))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=0.0", key))
|
||||||
}
|
}
|
||||||
case int:
|
case int:
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%d", f.Key, f.Value.(int)))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%d", key, value.(int)))
|
||||||
case int64:
|
case int64:
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%d", f.Key, f.Value.(int64)))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%d", key, value.(int64)))
|
||||||
case string:
|
case string:
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%q", f.Key, f.Value.(string)))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%q", key, value.(string)))
|
||||||
default:
|
default:
|
||||||
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", f.Key, f.Value))
|
fieldstr = append(fieldstr, fmt.Sprintf("%s=%v", key, value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(tagsstr) > 0 {
|
if len(tagsstr) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user