This commit fixes a bug where the state did not change from Alerting to Error if the evaluation result returned an error, or from Error to Alerting if evaluations stopped returning errors.
(cherry picked from commit 34d45977ca)
Co-authored-by: George Robinson <george.robinson@grafana.com>
* Alerting: Provisioning API respects global rule quota (#52180)
* Inject interface for quota service and create mock
* Check quota and return 403 if limit exceeded
* Implement tests for quota being exceeded
(cherry picked from commit 2d7389c34d)
* backport error check
Co-authored-by: Jean-Philippe Quémémer <jeanphilippe.quemener@grafana.com>
/api/admin/pause-all-alerts only takes effect for legacy alerts. This
change returns a 403 if it's called when legacy alerting is disabled.
Fixes#51729
(cherry picked from commit 0cbc14961a)
Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
* SQLstore: Fix fetching and deleting an inexistent playlist
xorm's session.Get() does not return an error if the raw does not exist.
It returns a boolean instead.
The playlist `sqlstore.GetPlaylist()` used to check only the error and in case
of inexistent UID didn't return an error.
(cherry picked from commit 4ff0f006dd)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Define query param and regenerate
* Add query struct for contact points
* Filter contact points by name in query
* Document that name filter is optional
(cherry picked from commit 0e066dd5f8)
Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
* Define route and run codegen
* Wire up HTTP layer
* Update API layer and test fakes
* Implement reset of policy tree
* Implement service layer test and authorization bindings
* API layer testing
* Be more specific when injecting settings
(cherry picked from commit fce283d73e)
Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
* Rendering: Fix user information when using render key
* fix when render user ID is 0
* update fix
* improve fix
* add comment
(cherry picked from commit ca80865bf1)
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
* Plugins: Register management endpoints only when external managed is also false (#51802)
* Only define plugin install endpoints when catalog enabled
* add external check
(cherry picked from commit 40dff288cd)
* fix test
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
* validate that the mute time intervals exist when updating routing tree
* run lint
* add tests
(cherry picked from commit 4a76436be2)
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
* Alerting: validate that the receiver exist when updating routing tree
* rename interface
* add missing file
* change constructor
* fix e2e tests
* only import package once
* add unit test for bug
* wording
* close response body
* Update pkg/services/ngalert/api/tooling/definitions/alertmanager_validation.go
* refactor to remove database roundtrip
(cherry picked from commit e64cde8727)
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
This commit makes a number of improvements to the image package:
- Improved comments
- Return the correct error when a dashboard does not exist
- Set a timeout in context.Context
(cherry picked from commit fe797dcfdc)
Co-authored-by: George Robinson <george.robinson@grafana.com>
* optional custom description for OpsGenie
* custom title and message, tests
* update changelog
* check for empty / whitespace only strings
* truncate the title to 130 characters if needed
* unnecessary validation removed
* truncate title to 127 characters and add three dots
(cherry picked from commit 9dc7e752b7)
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
Improves how we handle symlinks in plugin management.
(cherry picked from commit 04df634ef5)
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Plugins: Use a Grafana specific SDK logger implementation for core plugins (#51229)
Upgrade grafana-aws-sdk to v0.10.6
(cherry picked from commit a8eb29f1d7)
* fix go.mod go.sum
* Extend template and generate
* Generate and fix up alertmanager endpoints
* Prometheus routes
* fix up Testing endpoints
* touch up ruler API
* Update provisioning and fix 500
* Drop dead code
* Remove more dead code
* Resolve merge conflicts
(cherry picked from commit 0d9389e1f4)
* Alerting: Don't stop the migration when alert rule tags are invalid
As we migrate we expect the `alertRuleTags` on a dashboard alert to be a JSON object. However, it seems this is not really validated by Grafana and an user can change the format to something else that the JSON parser is not able to marshal into a `map[string]string`.
Let's do a bit better by "attempting" to parse the tags and if we can't we'll simple return an empty map. The data is still there so if the user wishes they can go back, fix the data and attemp the migration again.
(cherry picked from commit 90646e7f41)
* Chore: Remove global bus variable (#50765)
* Chore: Remove global bus variable
* fix bus in tests
(cherry picked from commit 0b55c41d05)
* fix the imports