Commit Graph

25 Commits

Author SHA1 Message Date
George Robinson 5979dff9dc
Show muted alerts in Alert Groups API (#3797)
This commit updates /api/v2/alerts/groups to show if an alert is
suppressed from one or more active or mute time intervals. While
the muted by field can be found in /api/v2/alerts, it is not
used here because /api/v2/alerts does not take aggregation
or routing into consideration.

It also updates the UI to support filtering muted alerts via the
Muted checkbox.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-10-23 16:42:21 +01:00
gotjosh aaf9490576
API: Allow the Silences API to use their own 400 response (#3610)
There's no change to the logic here - it just stroke me as odd that we were reusing the response from alerting groups in the silences call when it's pretty simple to add a new one in the API description.

This is more accurate as well, as this will be used to power the documentation.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-11-22 10:25:27 +00:00
gotjosh 2ec6b89aa7
Bump: go-swagger to latest stable
Bumps the API spec/client generation util of `go-swagger` from 0.30.2 to 0.30.5 which is the latest stable.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-10-19 12:11:29 +01:00
Emmanuel Lodovice 263ca5c943
api/v2: Delete silence respond with 404 when silence is not found (#3352)
Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>
2023-05-05 14:06:26 +01:00
Ben Kochie 432ee01c8c
Update Go to 1.19 (#3150)
* Update Go to 1.19

* Update Go.
* Update some Go modules.
* Update Swagger to the latest for Go 1.19 compatibility.
* api/v2: regenerate
* Accommodate to the changes in the client package
* asset/assets_vfsdata.go: regenerate

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-11-30 17:06:57 +01:00
Danny Kopping 143fd46467 Preferring the use of the basePath attribute
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
2021-11-16 00:42:43 +01:00
Danny Kopping 97e5779c3f Regenerated OpenAPI client code
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
2021-11-16 00:42:43 +01:00
Goutham Veeramachaneni e26425473c
Update go-openapi to latest
go-swagger 0.25.0+ are failing though :/

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2021-03-10 19:00:22 +01:00
Kiril Vladimirov 2b6315f399 api/v2: Add Matcher.IsEqual to support all types
Signed-off-by: Kiril Vladimirov <kiril@vladimiroff.org>
2021-02-16 14:22:59 +02:00
Simon Pasquier e347c31ab6
api/v2: return empty array of peers when disabled (#2203)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-03-10 15:47:43 +01:00
Simon Pasquier d5f6f88928
*: bump Open API dependencies (#2024)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-09 10:57:38 +02:00
Andrey Kuzmin 287c149f92 Regenerate v2 models
Signed-off-by: Andrey Kuzmin <andrey.kuzmin@soundcloud.com>
2019-04-27 12:44:12 +02:00
stuart nelson 2fa210d0e3 add groups endpoint to v2 api
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2019-04-17 11:32:21 +02:00
Paul Gier 89b0ff0574 api/v2: Respond with 404 when silence ID is not found (#1816)
When the client attempts to update a silence with a non-existent
ID, respond with a 404 (Not Found) instead of a 400 (Bad Request).

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-29 12:29:00 +01:00
Paul Gier 458f1d646b Makefile improvements
- make clean shouldn't print errors when files/directories have already
been removed
- add copyright header to generated api files to pass license check

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-11 10:45:45 -05:00
Paul Gier 538305bec9 update Makefile.common and license headers
Sync Makefile.common to latest which updates promu version
and adds license check to default target.
Add missing license headers.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-11 10:39:31 -05:00
Simon Pasquier bc373f562f *: fix filter parameters with comma
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-08 09:56:05 +01:00
Simon Pasquier c7de536129
*: use stdlib context (#1768)
This changes removes all usage of golang.org/x/net/context in the code
base. It also bumps a few dependencies for the same reason:
- github.com/gogo/protobuf
- go-openapi/*

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-02-26 12:18:57 +01:00
Max Leonard Inden 8e157b3af5
api/v2: Make cluster status peers and name optional
If a users chooses to disable the Alertmanager cluster feature, there is
no cluster name nor cluster peers. Hence these should be optional. Only
cluster status is set to "disabled".

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-02-04 11:40:30 +01:00
Max Leonard Inden 2f055d9966
api/v2: Do not populate cluster info if clustering is disabled
When users start Alertmanager with `--cluster.listen-address=`, the
cluster will not be initialized, hence api.peer will be `nil`. So far
this would result in a nil pointer dereference by the API v2 accessing
the api.peer field.

With this patch, api v2 skips populating the peers array, sets the name
to an empty string and the status to "disabled" in case `api.peer` is
nil.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-01-31 16:56:59 +01:00
Max Leonard Inden 2b697aaa6b
api/v2: Extract shared properties of gettable and postable alert
With issue 1465 on openapi-generator [1] being fixed, we can not extract
shared properties of the gettable and postable alert definition into a
shared object (`alert`) like we do for silence, gettable silence and
postable silence.

In addition this patch does the following changes to the UI:

- Use `List GettableAlert` instead of plural type definition like
`GettableAlerts` because the plural definitions are not generated.

- Fix openapi-generator-cli docker image to specific hash.

[1] https://github.com/OpenAPITools/openapi-generator/issues/1465

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-28 14:35:39 +01:00
Max Leonard Inden f504f953c1
ui: Move /alerts to API v2
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-23 12:53:48 +01:00
Max Leonard Inden b4b8b750df
api/v2/openapi.yaml: Differentiate between post and get silence
Instead of having one general silence, differentiate between postable
and gettable silence, hence making more fields required.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-15 16:21:07 +01:00
Max Leonard Inden e4e053b18e
ui: Move /status & /silences to API v2
This patch makes the Alertmanager UI (/status & /silences) use the
api/v2 endpoint. In addition it adds logic to generate the elm side data
model based on the OpenAPI specification.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-15 13:24:26 +01:00
Max Leonard Inden f1b920bcc9
api: Implement OpenAPI generated Alertmanager API V2
The current Alertmanager API v1 is undocumented and written by hand.
This patch introduces a new Alertmanager API - v2. The API is fully
generated via an OpenAPI 2.0 [1] specification (see
`api/v2/openapi.yaml`) with the exception of the http handlers itself.

Pros:
- Generated server code
- Ability to generate clients in all major languages
  (Go, Java, JS, Python, Ruby, Haskell, *elm* [3] ...)
    - Strict contract (OpenAPI spec) between server and clients.
    - Instant feedback on frontend-breaking changes, due to strictly
      typed frontend language elm.
- Generated documentation (See Alertmanager online Swagger UI [4])

Cons:
- Dependency on open api ecosystem including go-swagger [2]

In addition this patch includes the following changes.

- README.md: Add API section

- test: Duplicate acceptance test to API v1 & API v2 version

  The Alertmanager acceptance test framework has a decent test coverage
  on the Alertmanager API. Introducing the Alertmanager API v2 does not go
  hand in hand with deprecating API v1. They should live alongside each
  other for a couple of minor Alertmanager versions.

  Instead of porting the acceptance test framework to use the new API v2,
  this patch duplicates the acceptance tests, one using the API v1, the
  other API v2.

  Once API v1 is removed we can simply remove `test/with_api_v1` and bring
  `test/with_api_v2` to `test/`.

[1]
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

[2] https://github.com/go-swagger/go-swagger/

[3] https://github.com/ahultgren/swagger-elm

[4]
http://petstore.swagger.io/?url=https://raw.githubusercontent.com/mxinden/alertmanager/apiv2/api/v2/openapi.yaml

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-09-04 13:38:34 +02:00