Expression: Fix a bug of the display name of the threshold expression result (#85912)

* replace ReferenceVar with RefID when creating the math command for the ThresholdCommand

* Fix the Hysteresis test
pull/86076/head
Faye Lin 1 year ago committed by GitHub
parent 10c6ab5a17
commit a94ab259c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      pkg/expr/hysteresis_test.go
  2. 2
      pkg/expr/threshold.go

@ -15,7 +15,7 @@ import (
func TestHysteresisExecute(t *testing.T) {
number := func(label string, value float64) mathexp.Number {
n := mathexp.NewNumber("A", data.Labels{"label": label})
n := mathexp.NewNumber("B", data.Labels{"label": label})
n.SetValue(&value)
return n
}

@ -120,7 +120,7 @@ func (tc *ThresholdCommand) Execute(ctx context.Context, now time.Time, vars mat
return mathexp.Results{}, err
}
mathCommand, err := NewMathCommand(tc.ReferenceVar, mathExpression)
mathCommand, err := NewMathCommand(tc.RefID, mathExpression)
if err != nil {
return mathexp.Results{}, err
}

Loading…
Cancel
Save