grafana/pkg/expr/mathexp/testing.go
Kyle Brandt 01ef899753
SSE/Alerting: Support prom instant vector responses (#44865)
* SSE/Alerting: (Draft) Support prom instant vector responses
fixes #35663
* reduce\classic expressions to handle mathexp.Number
* use Notice for warning

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2022-05-23 10:08:14 -04:00

19 lines
377 B
Go

package mathexp
import (
"math/rand"
"github.com/grafana/grafana/pkg/util"
)
func GenerateNumber(value *float64) Number {
size := rand.Intn(5)
labels := make(map[string]string, size)
for i := 0; i < size; i++ {
labels[util.GenerateShortUID()] = util.GenerateShortUID()
}
result := NewNumber(util.GenerateShortUID(), labels)
result.SetValue(value)
return result
}