mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 12:37:25 +01:00
Refactoring: Replace FieldList() -> Fields()
This commit is contained in:
parent
bfeee55113
commit
d98b678399
@ -95,23 +95,23 @@ func (s *GangliaSink) Write(point lp.CCMetric) error {
|
|||||||
argstr = append(argstr, fmt.Sprintf("--desc=%q", strings.Join(tagsstr, ",")))
|
argstr = append(argstr, fmt.Sprintf("--desc=%q", strings.Join(tagsstr, ",")))
|
||||||
}
|
}
|
||||||
argstr = append(argstr, fmt.Sprintf("--name=%s", point.Name()))
|
argstr = append(argstr, fmt.Sprintf("--name=%s", point.Name()))
|
||||||
for _, f := range point.FieldList() {
|
for k, v := range point.Fields() {
|
||||||
if f.Key == "value" {
|
if k == "value" {
|
||||||
switch f.Value.(type) {
|
switch value := v.(type) {
|
||||||
case float64:
|
case float64:
|
||||||
argstr = append(argstr, fmt.Sprintf("--value=%v", f.Value.(float64)))
|
argstr = append(argstr, fmt.Sprintf("--value=%v", value))
|
||||||
argstr = append(argstr, "--type=double")
|
argstr = append(argstr, "--type=double")
|
||||||
case float32:
|
case float32:
|
||||||
argstr = append(argstr, fmt.Sprintf("--value=%v", f.Value.(float32)))
|
argstr = append(argstr, fmt.Sprintf("--value=%v", value))
|
||||||
argstr = append(argstr, "--type=float")
|
argstr = append(argstr, "--type=float")
|
||||||
case int:
|
case int:
|
||||||
argstr = append(argstr, fmt.Sprintf("--value=%d", f.Value.(int)))
|
argstr = append(argstr, fmt.Sprintf("--value=%d", value))
|
||||||
argstr = append(argstr, "--type=int32")
|
argstr = append(argstr, "--type=int32")
|
||||||
case int64:
|
case int64:
|
||||||
argstr = append(argstr, fmt.Sprintf("--value=%d", f.Value.(int64)))
|
argstr = append(argstr, fmt.Sprintf("--value=%d", value))
|
||||||
argstr = append(argstr, "--type=int32")
|
argstr = append(argstr, "--type=int32")
|
||||||
case string:
|
case string:
|
||||||
argstr = append(argstr, fmt.Sprintf("--value=%q", f.Value.(string)))
|
argstr = append(argstr, fmt.Sprintf("--value=%q", value))
|
||||||
argstr = append(argstr, "--type=string")
|
argstr = append(argstr, "--type=string")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user