Alerting: Extract alerting rules authorization logic to a service (#77006)

* extract alerting authorization logic to separate package
* convert authorization logic to service
This commit is contained in:
Yuri Tseretyan
2023-11-15 18:54:54 +02:00
committed by GitHub
parent 441403729f
commit 7cec741bae
17 changed files with 734 additions and 612 deletions
+8
View File
@@ -266,6 +266,14 @@ func WithQuery(query ...AlertQuery) AlertRuleMutator {
}
}
func WithGroupKey(groupKey AlertRuleGroupKey) AlertRuleMutator {
return func(rule *AlertRule) {
rule.RuleGroup = groupKey.RuleGroup
rule.OrgID = groupKey.OrgID
rule.NamespaceUID = groupKey.NamespaceUID
}
}
func GenerateAlertLabels(count int, prefix string) data.Labels {
labels := make(data.Labels, count)
for i := 0; i < count; i++ {