SSE/Alerting: First pass at query/condition translation (#31693)
- Takes the conditions property from the settings column of an alert from alerts table and turns into an ng alerting condition with the queries and classic condition. - Has temp API rest endpoint that will take the dashboard conditions json, translate it to SEE queries + classic condition, and execute it (only enabled in dev mode). - Changes expressions to catch query responses with a non-nil error property - Adds two new states for an NG instance result (NoData, Error) and updates evaluation to match those states - Changes the AsDataFrame (for frontend) from Bool to string to represent additional states - Fix bug in condition model to accept first Operator as empty string. - In ngalert, adds GetQueryDataRequest, which was part of execute and is still called from there. But this allows me to get the Expression request from a condition to make the "pipeline" can be built. - Update AsDataFrame for evalresult to be row based so it displays a little better for now
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"evaluator": {
|
||||
"params": [
|
||||
0
|
||||
],
|
||||
"type": "lt"
|
||||
},
|
||||
"operator": {
|
||||
"type": ""
|
||||
},
|
||||
"query": {
|
||||
"datasourceId": 2,
|
||||
"model": {
|
||||
"expr": "avg_over_time(sum by (instance) (up)[1h:5m])",
|
||||
"interval": "",
|
||||
"legendFormat": "",
|
||||
"refId": "A"
|
||||
},
|
||||
"params": [
|
||||
"A",
|
||||
"5m",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
"reducer": {
|
||||
"params": [],
|
||||
"type": "avg"
|
||||
},
|
||||
"type": "query"
|
||||
},
|
||||
{
|
||||
"evaluator": {
|
||||
"params": [
|
||||
0
|
||||
],
|
||||
"type": "gt"
|
||||
},
|
||||
"operator": {
|
||||
"type": "and"
|
||||
},
|
||||
"query": {
|
||||
"datasourceId": 2,
|
||||
"model": {
|
||||
"expr": "avg_over_time(sum by (instance) (up)[1h:5m])",
|
||||
"interval": "",
|
||||
"legendFormat": "",
|
||||
"refId": "A"
|
||||
},
|
||||
"params": [
|
||||
"A",
|
||||
"10m",
|
||||
"now-5m"
|
||||
]
|
||||
},
|
||||
"reducer": {
|
||||
"params": [],
|
||||
"type": "avg"
|
||||
},
|
||||
"type": "query"
|
||||
}
|
||||
]}
|
||||
Reference in New Issue
Block a user