Alerting: Add MissingSeriesEvalsToResolve to the APIs (#102150)

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
This commit is contained in:
Alexander Akhmetov
2025-03-26 13:34:53 +01:00
committed by GitHub
parent f2fc1d8575
commit f49a88ab72
17 changed files with 462 additions and 116 deletions
@@ -36,7 +36,8 @@
"labels": {
"label1": "test-label"
},
"isPaused": false
"isPaused": false,
"missing_series_evals_to_resolve": 1
},
{
"uid": "<dynamic>",
@@ -67,9 +68,10 @@
"labels": {
"label1": "test-label"
},
"isPaused": false
"isPaused": false,
"missing_series_evals_to_resolve": 2
}
]
}
]
}
}
@@ -46,7 +46,8 @@
"simplified_query_and_expressions_section": false,
"simplified_notifications_section": false
}
}
},
"missing_series_evals_to_resolve": 1
}
},
{
@@ -93,7 +94,8 @@
"simplified_query_and_expressions_section": false,
"simplified_notifications_section": false
}
}
},
"missing_series_evals_to_resolve": 2
}
}
]
@@ -24,7 +24,8 @@
}
],
"no_data_state": "NoData",
"exec_err_state": "Alerting"
"exec_err_state": "Alerting",
"missing_series_evals_to_resolve": 1
}
},
{
@@ -49,7 +50,8 @@
}
],
"no_data_state": "NoData",
"exec_err_state": "Alerting"
"exec_err_state": "Alerting",
"missing_series_evals_to_resolve": 2
}
}
]