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>
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>
* fix: change receiver pointer to value and add test
Signed-off-by: François Gouteroux <francois.gouteroux@gmail.com>
---------
Signed-off-by: François Gouteroux <francois.gouteroux@gmail.com>
* 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>
* Reduce memory utilization in downstream projects creating multiple Alertmanager instances
* Wrap the error instead of citing it
Signed-off-by: Marco Pracucci <marco@pracucci.com>
This is a of a nitpicky change, but having error logs on bad requests
is a bit of a pain. This means that a bad client can spam the logs with
bad requests that are really not actually an issue for the server -
we just send back the error and move on. This commit moves a couple of logs
from `Error` to `Debug` so that they can be filtered a bit better
Signed-off-by: sinkingpoint <colin@quirl.co.nz>
As part of #2971, I'm about to extend the test for silences - extract the functions into helpers as part of a separate file and add names to the expectations so that we can easily identify them.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
* API: Make conversion functions public
All types are public so it makes sense to make these functions also
public for ease of downstream consumption.
Signed-off-by: gotjosh <josue@grafana.com>
* Add the license header to the new file
Signed-off-by: gotjosh <josue@grafana.com>
* Fix tests
Signed-off-by: gotjosh <josue@grafana.com>
* Make two more helper functions public
Signed-off-by: gotjosh <josue@grafana.com>
A Peer as defined by the `cluster` package represents the node in the
cluster. It is used in other packages to know the status of all of the
members or how long should we wait to know if a notification has already fired.
In Cortex, we'd like to implement a slightly different way of
clustering (using gRPC for communication and a
hash ring for node discovery).
This is a small change to support that by changing the consumer of other
packages to an interface.
Silences and Notification channels don't need an interface as they take
a `func([]byte) error` as a parameter.
Signed-off-by: gotjosh <josue@grafana.com>
* Make filter labels consistent with Prometheus
Filtering the alert out when the label is missing precludes a
possible match for an empty value. This change allows the
match to be evaluated.
Closes#2342
Signed-off-by: Victor Araujo <vear91@gmail.com>
* Add tests for matchFilterLabels in v2 api
Signed-off-by: Victor Araujo <vear91@gmail.com>
* api/v2: add path and method to API v2 logs
When an API v2 handler logged a message, the log wouldn't include the
path and method. Since different handlers perform the same validations
(e.g. matchers for alerts and silences), it isn't easy to know which
handler was invoked (though the logged filename
+ line number provides a hint).
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Capitalize messages + improve logs
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix an error message about start and end time validation
Signed-off-by: Célian Garcia <celian.garcia@amadeus.com>
* Modified start and end time validation message to be affirmative
Signed-off-by: Célian Garcia <celian.garcia@amadeus.com>