Alerting: Metric to count imported from Prometheus rules (#100847)

This commit is contained in:
Alexander Akhmetov
2025-03-05 14:02:28 +01:00
committed by GitHub
parent 2638de6aeb
commit d44728f4e5
9 changed files with 161 additions and 22 deletions
+1 -4
View File
@@ -607,10 +607,7 @@ func (st DBstore) ListAlertRules(ctx context.Context, query *ngmodels.ListAlertR
}
}
if query.ImportedPrometheusRule != nil { // remove false-positive hits from the result
hasOriginalRuleDefinition := converted.Metadata.PrometheusStyleRule != nil && len(converted.Metadata.PrometheusStyleRule.OriginalRuleDefinition) > 0
if *query.ImportedPrometheusRule && !hasOriginalRuleDefinition {
continue
} else if !*query.ImportedPrometheusRule && hasOriginalRuleDefinition {
if *query.ImportedPrometheusRule != converted.ImportedFromPrometheus() {
continue
}
}