mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Use FromInfluxMetric() to convert influx to cc metric
This commit is contained in:
		@@ -10,7 +10,6 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
 | 
			
		||||
	influx "github.com/influxdata/line-protocol"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type MetricCollector interface {
 | 
			
		||||
@@ -115,24 +114,6 @@ func CpuList() []int {
 | 
			
		||||
	return cpulist
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Tags2Map stores a InfluxDB list of tags in a map of key value pairs
 | 
			
		||||
func Tags2Map(metric influx.Metric) map[string]string {
 | 
			
		||||
	tags := make(map[string]string)
 | 
			
		||||
	for _, t := range metric.TagList() {
 | 
			
		||||
		tags[t.Key] = t.Value
 | 
			
		||||
	}
 | 
			
		||||
	return tags
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Fields2Map stores a InfluxDB list of fields in a map of key value pairs
 | 
			
		||||
func Fields2Map(metric influx.Metric) map[string]interface{} {
 | 
			
		||||
	fields := make(map[string]interface{})
 | 
			
		||||
	for _, f := range metric.FieldList() {
 | 
			
		||||
		fields[f.Key] = f.Value
 | 
			
		||||
	}
 | 
			
		||||
	return fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RemoveFromStringList removes the string r from the array of strings s
 | 
			
		||||
// If r is not contained in the array an error is returned
 | 
			
		||||
func RemoveFromStringList(s []string, r string) ([]string, error) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user