mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-02-17 16:31:46 +01:00
Format with gofumpt
This commit is contained in:
@@ -72,10 +72,12 @@ var metricCacheLanguage = gval.NewLanguage(
|
||||
gval.Function("getCpuList", getCpuListOfNode),
|
||||
gval.Function("getCpuListOfType", getCpuListOfType),
|
||||
)
|
||||
|
||||
var language gval.Language = gval.NewLanguage(
|
||||
gval.Full(),
|
||||
metricCacheLanguage,
|
||||
)
|
||||
|
||||
var evaluables = struct {
|
||||
mapping map[string]gval.Evaluable
|
||||
mutex sync.Mutex
|
||||
@@ -359,10 +361,9 @@ func EvalBoolCondition(condition string, params map[string]any) (bool, error) {
|
||||
evaluable, ok := evaluables.mapping[condition]
|
||||
evaluables.mutex.Unlock()
|
||||
if !ok {
|
||||
newcond :=
|
||||
newcond := strings.ReplaceAll(
|
||||
strings.ReplaceAll(
|
||||
strings.ReplaceAll(
|
||||
condition, "'", "\""), "%", "\\")
|
||||
condition, "'", "\""), "%", "\\")
|
||||
var err error
|
||||
evaluable, err = language.NewEvaluable(newcond)
|
||||
if err != nil {
|
||||
@@ -381,10 +382,9 @@ func EvalFloat64Condition(condition string, params map[string]float64) (float64,
|
||||
evaluable, ok := evaluables.mapping[condition]
|
||||
evaluables.mutex.Unlock()
|
||||
if !ok {
|
||||
newcond :=
|
||||
newcond := strings.ReplaceAll(
|
||||
strings.ReplaceAll(
|
||||
strings.ReplaceAll(
|
||||
condition, "'", "\""), "%", "\\")
|
||||
condition, "'", "\""), "%", "\\")
|
||||
var err error
|
||||
evaluable, err = language.NewEvaluable(newcond)
|
||||
if err != nil {
|
||||
|
||||
@@ -35,7 +35,6 @@ func sumAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error
|
||||
|
||||
// Sum up values
|
||||
func sumfunc(args any) (any, error) {
|
||||
|
||||
var err error
|
||||
switch values := args.(type) {
|
||||
case []float64:
|
||||
@@ -168,7 +167,7 @@ func medianfunc(args any) (any, error) {
|
||||
*/
|
||||
|
||||
func lenfunc(args any) (any, error) {
|
||||
var err error = nil
|
||||
var err error
|
||||
length := 0
|
||||
switch values := args.(type) {
|
||||
case []float64:
|
||||
|
||||
@@ -79,7 +79,6 @@ func (c *metricCache) Init(output chan lp.CCMessage, ticker mct.MultiChanTicker,
|
||||
|
||||
// Start starts the metric cache
|
||||
func (c *metricCache) Start() {
|
||||
|
||||
c.tickchan = make(chan time.Time)
|
||||
c.ticker.AddChannel(c.tickchan)
|
||||
// Router cache is done
|
||||
@@ -171,7 +170,6 @@ func (c *metricCache) GetPeriod(index int) (time.Time, time.Time, []lp.CCMessage
|
||||
start = c.intervals[pindex].startstamp
|
||||
stop = c.intervals[pindex].stopstamp
|
||||
metrics = c.intervals[pindex].metrics
|
||||
//return c.intervals[pindex].startstamp, c.intervals[pindex].stopstamp, c.intervals[pindex].metrics
|
||||
} else {
|
||||
metrics = make([]lp.CCMessage, 0)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"time"
|
||||
|
||||
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
|
||||
|
||||
lp "github.com/ClusterCockpit/cc-lib/v2/ccMessage"
|
||||
mp "github.com/ClusterCockpit/cc-lib/v2/messageProcessor"
|
||||
agg "github.com/ClusterCockpit/cc-metric-collector/internal/metricAggregator"
|
||||
@@ -244,7 +243,6 @@ func (r *metricRouter) Start() {
|
||||
// Forward message received from collector channel
|
||||
coll_forward := func(p lp.CCMessage) {
|
||||
// receive from metric collector
|
||||
//p.AddTag(r.config.HostnameTagName, r.hostname)
|
||||
if r.config.IntervalStamp {
|
||||
p.SetTime(r.timestamp)
|
||||
}
|
||||
@@ -292,7 +290,6 @@ func (r *metricRouter) Start() {
|
||||
}
|
||||
|
||||
r.wg.Go(func() {
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-r.done:
|
||||
|
||||
Reference in New Issue
Block a user