mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add recording rules to ruler API and validation (#87779)
* Read path, main API * Define record field for incoming requests * Refactor several alerting specific validators into two paths * Refactor validateCondition actually contain all the condition validation logic * Move condition validation inside rule path * Validators for recording rules * Wire feature flag through to validators * Test for accepting a valid recording rule * Tests for negative case, no UID * Test for ignoring alerting fields * Build conditions based on recording rules as well * Regenerate swagger docs * Fix CRUD test to cover the right thing * Re-generate swagger docs with backdated v0.30.2 version * Regenerate base spec * Regenerate ngalert specs * Regenerate top level specs * Comment and rename * Return struct instead of modifying ref
This commit is contained in:
@@ -337,6 +337,12 @@ func (alertRule *AlertRule) GetLabels(opts ...LabelOption) map[string]string {
|
||||
}
|
||||
|
||||
func (alertRule *AlertRule) GetEvalCondition() Condition {
|
||||
if alertRule.IsRecordingRule() {
|
||||
return Condition{
|
||||
Condition: alertRule.Record.From,
|
||||
Data: alertRule.Data,
|
||||
}
|
||||
}
|
||||
return Condition{
|
||||
Condition: alertRule.Condition,
|
||||
Data: alertRule.Data,
|
||||
|
||||
Reference in New Issue
Block a user