mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00

What is this feature? A follow-up for #101184, adds AlertRule.MissingSeriesEvalsToResolve to the APIs. missing_series_evals_to_resolve must be specified too and it must be > 0. POST /api/ruler/grafana/api/v1/rules/{folderUID} works in the following way: If missing_series_evals_to_resolve is not sent or null, the rule keeps its existing value If missing_series_evals_to_resolve > 0: updates to that value If missing_series_evals_to_resolve = 0: resets to default (nil). AlertRule.MissingSeriesEvalsToResolve can't be 0, so I used it to reset In the Provisioning API, the value is just set if present and > 0. Otherwise it's reset: PUT to /api/v1/provisioning/alert-rules/{UID}: If missing_series_evals_to_resolve is nil, it's reset to the default value If missing_series_evals_to_resolve > 0, it's updated
78 lines
1.8 KiB
JSON
78 lines
1.8 KiB
JSON
{
|
|
"apiVersion": 1,
|
|
"groups": [
|
|
{
|
|
"orgId": 1,
|
|
"name": "Group1",
|
|
"folder": "<dynamic>",
|
|
"interval": "1m",
|
|
"rules": [
|
|
{
|
|
"uid": "<dynamic>",
|
|
"title": "Rule1",
|
|
"condition": "A",
|
|
"data": [
|
|
{
|
|
"refId": "A",
|
|
"relativeTimeRange": {
|
|
"from": 0,
|
|
"to": 0
|
|
},
|
|
"datasourceUid": "__expr__",
|
|
"model": {
|
|
"expression": "0 \u003e 0",
|
|
"intervalMs": 1000,
|
|
"maxDataPoints": 43200,
|
|
"type": "math"
|
|
}
|
|
}
|
|
],
|
|
"noDataState": "NoData",
|
|
"execErrState": "Alerting",
|
|
"for": "5m",
|
|
"annotations": {
|
|
"annotation": "test-annotation"
|
|
},
|
|
"labels": {
|
|
"label1": "test-label"
|
|
},
|
|
"isPaused": false,
|
|
"missing_series_evals_to_resolve": 1
|
|
},
|
|
{
|
|
"uid": "<dynamic>",
|
|
"title": "Rule2",
|
|
"condition": "A",
|
|
"data": [
|
|
{
|
|
"refId": "A",
|
|
"relativeTimeRange": {
|
|
"from": 0,
|
|
"to": 0
|
|
},
|
|
"datasourceUid": "__expr__",
|
|
"model": {
|
|
"expression": "0 == 0",
|
|
"intervalMs": 1000,
|
|
"maxDataPoints": 43200,
|
|
"type": "math"
|
|
}
|
|
}
|
|
],
|
|
"noDataState": "NoData",
|
|
"execErrState": "Alerting",
|
|
"for": "5m",
|
|
"annotations": {
|
|
"annotation": "test-annotation"
|
|
},
|
|
"labels": {
|
|
"label1": "test-label"
|
|
},
|
|
"isPaused": false,
|
|
"missing_series_evals_to_resolve": 2
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|