mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Add two helper functions to collector definition
This commit is contained in:
		@@ -116,3 +116,19 @@ func CpuList() []int {
 | 
			
		||||
	}
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user