Alerting: Add totalsFiltered to RuleResponse for hidden by filters count (#66883)

Alerting: Add totalsFiltered to RuleResponse to facilitate hidden by filters count

Currently, when both a limit_alerts and a matcher/state filter is applied, there is not enough information to determine how many alert instances were hidden by the filters. Only enough to determine the total hidden by the limit and filter combined.

This change adds a separate totalsFiltered field alongside the AlertRule totals that will contain the count of instances after filters but before limits.
This commit is contained in:
Matthew Jacobson
2023-04-21 09:35:12 +01:00
committed by GitHub
parent 29aaf429ad
commit eddd4f4508
3 changed files with 71 additions and 5 deletions
@@ -134,9 +134,10 @@ type AlertingRule struct {
// required: true
Annotations overrideLabels `json:"annotations,omitempty"`
// required: true
ActiveAt *time.Time `json:"activeAt,omitempty"`
Alerts []Alert `json:"alerts,omitempty"`
Totals map[string]int64 `json:"totals,omitempty"`
ActiveAt *time.Time `json:"activeAt,omitempty"`
Alerts []Alert `json:"alerts,omitempty"`
Totals map[string]int64 `json:"totals,omitempty"`
TotalsFiltered map[string]int64 `json:"totalsFiltered,omitempty"`
Rule
}