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>

docs(changelog): Add link to MR #5534
  • Loading branch information
audig authored and adcg committed Jul 22, 2022
1 parent 22461a6 commit f5c01c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Fixed
- [#5502](https://github.com/thanos-io/thanos/pull/5502) Receive: Handle exemplar storage errors as conflict error.
- [#5534](https://github.com/thanos-io/thanos/pull/5534) Query: Set struct return by query api alerts same as prometheus api

### Added

Expand Down
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 f5c01c8

Please sign in to comment.