move out label copy and params copy to the outside of the loop

This commit is contained in:
c9s 2022-06-20 15:27:01 +08:00
parent 9be38e2421
commit 626934a059
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -176,10 +176,10 @@ func (o *GridOptimizer) Run(executor Executor, configJson []byte) (map[string][]
return err
}
var labels = copyLabels(o.ParamLabels)
var currentParams = copyParams(o.CurrentParams)
for metricName, metricFunc := range valueFunctions {
var metricValue = metricFunc(summaryReport)
var currentParams = copyParams(o.CurrentParams)
var labels = copyLabels(o.ParamLabels)
metrics[metricName] = append(metrics[metricName], Metric{
Params: currentParams,