mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Alerting: Add RuleGroup field to ListAlertInstancesQuery struct (#94615)
Alerting: add RuleGroup field to ListAlertInstancesQuery struct
This commit is contained in:
parent
22d5efba25
commit
0b804e720f
@ -55,6 +55,7 @@ func (i InstanceStateType) IsValid() bool {
|
||||
type ListAlertInstancesQuery struct {
|
||||
RuleUID string
|
||||
RuleOrgID int64 `json:"-"`
|
||||
RuleGroup string
|
||||
}
|
||||
|
||||
// ValidateAlertInstance validates that the alert instance contains an alert rule id,
|
||||
|
@ -33,6 +33,9 @@ func (st DBstore) ListAlertInstances(ctx context.Context, cmd *models.ListAlertI
|
||||
if cmd.RuleUID != "" {
|
||||
addToQuery(` AND rule_uid = ?`, cmd.RuleUID)
|
||||
}
|
||||
if cmd.RuleGroup != "" {
|
||||
return errors.New("filtering by RuleGroup is not supported")
|
||||
}
|
||||
|
||||
if st.FeatureToggles.IsEnabled(ctx, featuremgmt.FlagAlertingNoNormalState) {
|
||||
s.WriteString(fmt.Sprintf(" AND NOT (current_state = '%s' AND current_reason = '')", models.InstanceStateNormal))
|
||||
|
Loading…
Reference in New Issue
Block a user