grafana/pkg/expr/translate/testdata/mixedSharedUnsharedTimeRange.json
Kyle Brandt 7bb79158ed
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
2021-03-23 12:11:15 -04:00

354 lines
7.6 KiB
JSON

{
"conditions": [
{
"evaluator": {
"params": [
3
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "B",
"scenarioId": "predictable_pulse",
"stringInput": ""
},
"params": [
"B",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
},
{
"evaluator": {
"params": [
2,
5
],
"type": "within_range"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "B",
"scenarioId": "predictable_pulse",
"stringInput": ""
},
"params": [
"B",
"10m",
"now-5m"
]
},
"reducer": {
"params": [],
"type": "max"
},
"type": "query"
},
{
"evaluator": {
"params": [
6
],
"type": "gt"
},
"operator": {
"type": "or"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "A",
"scenarioId": "predictable_csv_wave",
"stringInput": ""
},
"params": [
"A",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "sum"
},
"type": "query"
},
{
"evaluator": {
"params": [
7
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "A",
"scenarioId": "predictable_csv_wave",
"stringInput": ""
},
"params": [
"A",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
},
{
"evaluator": {
"params": [],
"type": "no_value"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "C",
"scenarioId": "no_data_points",
"stringInput": ""
},
"params": [
"C",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "diff"
},
"type": "query"
},
{
"evaluator": {
"params": [
9
],
"type": "gt"
},
"operator": {
"type": "or"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "D",
"scenarioId": "predictable_csv_wave",
"stringInput": ""
},
"params": [
"D",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "diff_abs"
},
"type": "query"
},
{
"evaluator": {
"params": [
10
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "D",
"scenarioId": "predictable_csv_wave",
"stringInput": ""
},
"params": [
"D",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "percent_diff"
},
"type": "query"
},
{
"evaluator": {
"params": [
11
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"datasourceId": 4,
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"hide": false,
"lines": 10,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "D",
"scenarioId": "predictable_csv_wave",
"stringInput": ""
},
"params": [
"D",
"10m",
"now"
]
},
"reducer": {
"params": [],
"type": "percent_diff_abs"
},
"type": "query"
}
]
}