mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-02-13 14:41:45 +01:00
* Replace fmt.Sprintf("%d", i)) by strconv.Itoa(i)
* Correct misspelled words * Remove unused code * Break up very long lines into multiple lines * lp.NewMessage -> lp.NewMetric
This commit is contained in:
@@ -170,22 +170,22 @@ func (c *metricAggregator) Eval(starttime time.Time, endtime time.Time, metrics
|
||||
// Check, that only values of one type were collected
|
||||
countValueTypes := 0
|
||||
if len(valuesFloat64) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if len(valuesFloat32) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if len(valuesInt) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if len(valuesInt32) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if len(valuesInt64) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if len(valuesBool) > 0 {
|
||||
countValueTypes += 1
|
||||
countValueTypes++
|
||||
}
|
||||
if countValueTypes > 1 {
|
||||
cclog.ComponentError("MetricCache", "Collected values of different types")
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
topo "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology"
|
||||
@@ -208,7 +209,7 @@ func infunc(a any, b any) (any, error) {
|
||||
case []int:
|
||||
return slices.Contains(total, match), nil
|
||||
case string:
|
||||
smatch := fmt.Sprintf("%d", match)
|
||||
smatch := strconv.Itoa(match)
|
||||
return strings.Contains(total, smatch), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user