mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-27 07:39:05 +01:00
Input parameters should be float64 when evaluating to float64
This commit is contained in:
parent
1aca1b6caf
commit
302e42d1d0
@ -62,7 +62,7 @@ type LikwidEventsetConfig struct {
|
|||||||
eorder []*C.char
|
eorder []*C.char
|
||||||
estr *C.char
|
estr *C.char
|
||||||
go_estr string
|
go_estr string
|
||||||
results map[int]map[string]interface{}
|
results map[int]map[string]float64
|
||||||
metrics map[int]map[string]float64
|
metrics map[int]map[string]float64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,10 +139,10 @@ func genLikwidEventSet(input LikwidCollectorEventsetConfig) LikwidEventsetConfig
|
|||||||
elist = append(elist, c_counter)
|
elist = append(elist, c_counter)
|
||||||
}
|
}
|
||||||
estr := strings.Join(tmplist, ",")
|
estr := strings.Join(tmplist, ",")
|
||||||
res := make(map[int]map[string]interface{})
|
res := make(map[int]map[string]float64)
|
||||||
met := make(map[int]map[string]float64)
|
met := make(map[int]map[string]float64)
|
||||||
for _, i := range topo.CpuList() {
|
for _, i := range topo.CpuList() {
|
||||||
res[i] = make(map[string]interface{})
|
res[i] = make(map[string]float64)
|
||||||
for k := range input.Events {
|
for k := range input.Events {
|
||||||
res[i][k] = 0.0
|
res[i][k] = 0.0
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ func genLikwidEventSet(input LikwidCollectorEventsetConfig) LikwidEventsetConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testLikwidMetricFormula(formula string, params []string) bool {
|
func testLikwidMetricFormula(formula string, params []string) bool {
|
||||||
myparams := make(map[string]interface{})
|
myparams := make(map[string]float64)
|
||||||
for _, p := range params {
|
for _, p := range params {
|
||||||
myparams[p] = float64(1.0)
|
myparams[p] = float64(1.0)
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, inter
|
|||||||
for domain, tid := range scopemap {
|
for domain, tid := range scopemap {
|
||||||
if tid >= 0 {
|
if tid >= 0 {
|
||||||
// Here we generate parameter list
|
// Here we generate parameter list
|
||||||
params := make(map[string]interface{})
|
params := make(map[string]float64)
|
||||||
for _, evset := range groups {
|
for _, evset := range groups {
|
||||||
for mname, mres := range evset.metrics[tid] {
|
for mname, mres := range evset.metrics[tid] {
|
||||||
params[mname] = mres
|
params[mname] = mres
|
||||||
|
@ -367,7 +367,7 @@ func EvalBoolCondition(condition string, params map[string]interface{}) (bool, e
|
|||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func EvalFloat64Condition(condition string, params map[string]interface{}) (float64, error) {
|
func EvalFloat64Condition(condition string, params map[string]float64) (float64, error) {
|
||||||
evaluables.mutex.Lock()
|
evaluables.mutex.Lock()
|
||||||
evaluable, ok := evaluables.mapping[condition]
|
evaluable, ok := evaluables.mapping[condition]
|
||||||
evaluables.mutex.Unlock()
|
evaluables.mutex.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user