Alerting: interpolate variables when creating alert rule from dashboard panel (#37201)

This commit is contained in:
Domas
2021-08-10 10:59:48 +03:00
committed by GitHub
parent 488930dbe3
commit 3e124c854e
7 changed files with 401 additions and 37 deletions

View File

@@ -186,7 +186,7 @@ func (s *Service) buildDSNode(dp *simple.DirectedGraph, rn *rawNode, req *Reques
}
var floatIntervalMS float64
if rawIntervalMS := rn.Query["intervalMs"]; ok {
if rawIntervalMS, ok := rn.Query["intervalMs"]; ok {
if floatIntervalMS, ok = rawIntervalMS.(float64); !ok {
return nil, fmt.Errorf("expected intervalMs to be an float64, got type %T for refId %v", rawIntervalMS, rn.RefID)
}
@@ -194,7 +194,7 @@ func (s *Service) buildDSNode(dp *simple.DirectedGraph, rn *rawNode, req *Reques
}
var floatMaxDP float64
if rawMaxDP := rn.Query["maxDataPoints"]; ok {
if rawMaxDP, ok := rn.Query["maxDataPoints"]; ok {
if floatMaxDP, ok = rawMaxDP.(float64); !ok {
return nil, fmt.Errorf("expected maxDataPoints to be an float64, got type %T for refId %v", rawMaxDP, rn.RefID)
}