Skip to content

Commit 0b804e7

Browse files
Alerting: Add RuleGroup field to ListAlertInstancesQuery struct (#94615)
Alerting: add RuleGroup field to ListAlertInstancesQuery struct
1 parent 22d5efb commit 0b804e7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/services/ngalert/models/instance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func (i InstanceStateType) IsValid() bool {
5555
type ListAlertInstancesQuery struct {
5656
RuleUID string
5757
RuleOrgID int64 `json:"-"`
58+
RuleGroup string
5859
}
5960

6061
// ValidateAlertInstance validates that the alert instance contains an alert rule id,

pkg/services/ngalert/store/instance_database.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ func (st DBstore) ListAlertInstances(ctx context.Context, cmd *models.ListAlertI
3333
if cmd.RuleUID != "" {
3434
addToQuery(` AND rule_uid = ?`, cmd.RuleUID)
3535
}
36+
if cmd.RuleGroup != "" {
37+
return errors.New("filtering by RuleGroup is not supported")
38+
}
3639

3740
if st.FeatureToggles.IsEnabled(ctx, featuremgmt.FlagAlertingNoNormalState) {
3841
s.WriteString(fmt.Sprintf(" AND NOT (current_state = '%s' AND current_reason = '')", models.InstanceStateNormal))

0 commit comments

Comments
 (0)