mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 23:19:06 +01:00
Add two helper functions to collector definition
This commit is contained in:
parent
7f1694adc7
commit
4688997071
@ -116,3 +116,19 @@ func CpuList() []int {
|
|||||||
}
|
}
|
||||||
return cpulist
|
return cpulist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Tags2Map(metric lp.Metric) map[string]string {
|
||||||
|
tags := make(map[string]string)
|
||||||
|
for _, t := range metric.TagList() {
|
||||||
|
tags[t.Key] = t.Value
|
||||||
|
}
|
||||||
|
return tags
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fields2Map(metric lp.Metric) map[string]interface{} {
|
||||||
|
fields := make(map[string]interface{})
|
||||||
|
for _, f := range metric.FieldList() {
|
||||||
|
fields[f.Key] = f.Value
|
||||||
|
}
|
||||||
|
return fields
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user