Skip to content

Commit

Permalink
fix(api): When querying api query on endpoint alerts return a json st…
Browse files Browse the repository at this point in the history
…ruct with alerts in lowercase.

To be same result as prometheus api
Signed-off-by: audig <audic.gui@gmail.com>
  • Loading branch information
audig committed Jul 22, 2022
1 parent 22461a6 commit 38eab45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/api/query/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,9 @@ func NewAlertsHandler(client rules.UnaryClient, enablePartialResponse bool) func
return nil, nil, &api.ApiError{Typ: api.ErrorInternal, Err: errors.Errorf("error retrieving rules: %v", err)}
}

var resp struct{ Alerts []*rulespb.AlertInstance }
var resp struct {
Alerts []*rulespb.AlertInstance `json:"alerts"`
}
for _, g := range groups.Groups {
for _, r := range g.Rules {
a := r.GetAlert()
Expand Down

0 comments on commit 38eab45

Please sign in to comment.