Commit Graph

6780 Commits

Author SHA1 Message Date
Malcolm Holmes d2cccfe91e lint 2021-12-07 15:04:55 +00:00
Sofia Papagiannaki 3a560293c2 Improve comments and error message. 2021-12-06 09:24:21 +02:00
Kyle Brandt a864be9272 security: fix dir traversal issue 2021-12-03 12:59:42 -05:00
Marcus Efraimsson eff8fa14c6 Chore: Fix flaky serverlock integration test (#42633) (#42646)
(cherry picked from commit 54fa7b57fe)
2021-12-02 14:26:13 +01:00
Joan López de la Franca Beltran 704681e2f7 Create 'runner' directory within grafana-cli (#42589) 2021-12-01 17:36:45 +01:00
Grot (@grafanabot) 288621b68a Settings: Fix handling (#42497) (#42510)
* Settings: Fix handling

(cherry picked from commit 690ffdff56)

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
2021-11-30 12:02:14 +01:00
Grot (@grafanabot) 995ec00121 Alerting: fix a bug where the metric in the evaluation string was not correctly populated (#41731) (#41793)
Instead of using the frame name as the series name, we now use the name of the series value column if the frame name is not set. Queries to some datasources may end up with an empty frame name, which leads to an empty series name. As the series name is used in the frontend to display which metrics were queried etc. it shouldn't be empty.

(cherry picked from commit 2319c52c85)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2021-11-17 11:34:51 +01:00
Dimitris Sotirakis 7d5f1d74f0 Security Fix: Fine-grained access control enables organization admins to create/modify/delete user roles in other organization (#41705) 2021-11-15 17:10:55 +01:00
Grot (@grafanabot) c5a99b2a32 OAuth: Fix group mapping when use generic OAuth (#41418) (#41628)
* Fix group mapping when use generic OAuth

* Fix lint

* Fix lint

(cherry picked from commit 25ad916473)

Co-authored-by: Selene <selenepinillos@gmail.com>
2021-11-12 11:18:42 +01:00
George Robinson eddcdd8d66 Alerting: Fix NoDataFound for alert rules using the AND operator (#41305) (#41524)
This commit fixes an issue in alerting where NoDataFound is false
when using the AND operator to compare two conditions in an alert
rule and one of the conditions has no data.

(cherry picked from commit d6ed5d295e)
2021-11-11 16:01:23 +00:00
Grot (@grafanabot) ec8e606de0 InfluxDB: fix numeric aliases in queries (#41531) (#41587)
* influxdb: alerting: handle out-of-range numeric aliases

* influxdb: updated documentation

(cherry picked from commit eb47a58029)

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2021-11-11 09:48:58 +01:00
Grot (@grafanabot) 3110e11330 fix: check lotex endpoint URL (#41429) (#41585)
* fix: check lotex endpoint URL

* Add validation for data sources URLs

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
(cherry picked from commit dbe78e47b1)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2021-11-11 08:19:44 +01:00
Grot (@grafanabot) 5f5e962b2d Alerting: Special alert instance if rule is in state NoData (#40540) (#41525)
* do not suppress NoData state
* extract conversion of state to postable alert + tests
* create a special alert instance if nodata
* use NoData when converting from Keep Last State instead of Alerting
* add silence during migration if NoData is mapped to KeepLastState.

(cherry picked from commit 610643a668)

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-11-10 12:15:23 +01:00
Grot (@grafanabot) d80013022e Alerting: Parse App URL only once (#39855) (#41522)
(cherry picked from commit 2b4e51f478)

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-11-10 10:44:35 +00:00
Grot (@grafanabot) fff0da8fe9 DataProxy: Fix issue overriding response body when response status is 101 (#41364) (#41476)
When a request going through Grafana data source proxy responds with a websocket
upgrade response we cannot override the response body since it produces an error.
This problem seems to have been introduced in Grafana v8.0 by #38962.
In addition #40303 added same problem.

Fixes #41292

(cherry picked from commit 3be452f995)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-11-09 15:04:44 +01:00
Grot (@grafanabot) 3b8be57b4f Alerting: fix bug where user is able to access rules from namespaces user is not part of (#41403) (#41406)
* Add fix
* Add tests
(cherry picked from commit 6220872633)

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
Co-authored-by: Armand Grillet <2117580+armandgrillet@users.noreply.github.com>
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
Co-authored-by: George Robinson <george.robinson@grafana.com>
Co-authored-by: gotjosh <josue@grafana.com>
2021-11-08 18:57:51 +01:00
Will Browne 5350c74b39 backport of 41346 (#41365) 2021-11-05 16:19:14 +01:00
Grot (@grafanabot) 9a2e14d3e5 InfluxDB: Fix regular expression to parse aliases according to documentation (#41186) (#41190)
* Fix regular expression to parse aliases that start with either square brackets or dollar sign

* Fix lint

(cherry picked from commit 8a3e192e6a)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-11-02 13:53:37 +01:00
Grot (@grafanabot) edb2644951 Cloudwatch: Add support for AWS/Backup metrics and dimensions (#41077) (#41086)
Add AWS/Backup supported metrics and dimensions based on the official
AWS documentation.

(cherry picked from commit b9e0a41f5a)

Co-authored-by: Szymon Szypulski <szymon.szypulski@gmail.com>
2021-10-29 13:17:22 +02:00
Tania B 8ac788c71a [8.2.x] Fix decrypting secrets in alerting migration (#41057)
* Add support for decrypting secrets with metadata prefix

* Update tests
2021-10-29 13:28:48 +03:00
Grot (@grafanabot) c3e46eaa8f Rendering: Check if default image exists to avoid breaking reports if it's moved (#40930) (#40991)
(cherry picked from commit 37cbed4b48)

Co-authored-by: Selene <selenepinillos@gmail.com>
2021-10-27 16:41:47 +02:00
Grot (@grafanabot) a8ecdca826 Datasources: Set response size metric based on actual bytes read (#40303) (#40867)
Fixes #33372

(cherry picked from commit 889d4683a1)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-10-25 13:01:16 +02:00
Grot (@grafanabot) 908a951fc0 Alerting: fix ngalert alertmanager SQL Syntax Errors (#40827) (#40868)
* test kvstore in intregration tests with different databases

* escape 'key' in delete query

* export quote and use it in kvstore

(cherry picked from commit d1aefa1792)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2021-10-25 12:23:32 +02:00
Hugo Häggmark 01468d2ac1 LibraryElements: fixes flaky tests (#40791) (#40796)
(cherry picked from commit c70cfe9125)
2021-10-25 06:08:11 +02:00
gotjosh abd1050f98 [8.2.x] Alerting: Validate contact point configuration during migration to Unified Alerting (#40717) (#40801)
* Alerting: Validate contact point configuration during migration to Unified Alerting (#40717)

* Alerting: Validate contact point configuration during the migration

This minimises the chances of generating broken configuration as part of the migration. Originally, we wanted to generate it and not produce a hard stop in Grafana but this strategy has the chance to avoid delivering notifications for our users.

We now think it's better to hard stop the migration and let the user take care of resolving the configuration manually.

(cherry picked from commit 74fb491b6a)
2021-10-22 12:16:36 +01:00
Grot (@grafanabot) c7f488580a Alerting: Fix kv_store query to escape reserved word (#40788) (#40795)
(cherry picked from commit a5501b7845)

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-10-22 09:27:19 +02:00
Sofia Papagiannaki b8a1af0db1 Hide Grafana 8 alerts for disabled org (#40687) (#40745)
(cherry picked from commit 2c28aea654)
2021-10-21 10:43:59 +02:00
Armand Grillet f3b8c1a89d Fix panic when Slack API sends unexpected response (#40721) (#40741)
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2021-10-21 10:49:07 +03:00
Grot (@grafanabot) d67b6e23ea Alerting: delete orphaned records from kvstore (#40337) (#40450)
(cherry picked from commit 153c356993)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2021-10-14 12:32:57 +02:00
Grot (@grafanabot) 83e58575ef CloudWatch: Add AWS Elastic GPUs metrics and dimensions (#40253) (#40436)
* CloudWatch: Added AWS Elastic GPUs metrics and dimensions

* Delete extra space

(cherry picked from commit 665055dbbc)

Co-authored-by: Ilya Stoliar <52413756+ilyastoli@users.noreply.github.com>
2021-10-14 10:09:40 +02:00
Grot (@grafanabot) 7689b2f5ec Forbid creation of dashboard permissions with both a user and a team (#40104) (#40412)
These permissions could be created through the API but would not show
correctly in the UI.

(cherry picked from commit 5af96544f3)

Co-authored-by: Jesse Weaver <pianohacker@gmail.com>
2021-10-13 16:10:40 -06:00
Marcus Efraimsson 92d768fe66 Prometheus: Fix issue where TCP connections not being reused when querying from Grafana alerting (#40349) (#40368)
Fixes #40366

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
(cherry picked from commit 23bee50474)

Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
2021-10-13 11:19:04 +02:00
Grot (@grafanabot) c57041f13b Application: Make error-template title configurable (#40310) (#40363)
* Fix error-template title

as in index-template.html

* Test: fix for AppTitle

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
(cherry picked from commit 3d9e2d8c82)

Co-authored-by: Ben RUBSON <6764151+benrubson@users.noreply.github.com>
2021-10-13 09:08:18 +02:00
Grot (@grafanabot) ea2976180b [v8.2.x] Alerting: Remove invalid Slack URL as we migrate notification channels (#40356)
* Alerting: Remove invalid Slack URL as we migrate notification channels (#40344)

* Alerting: Remove invalid Slack URL as we migrate notification channels

Grafana will accept any type of utf8 valid string as the Slack URL and will simply fail as we try to deliver the notification of the channel. The Alertmanager will fail to apply a configuration if the URL of the Slack Receiver is invalid.

This change takes that into account by removing the URL for the receiver as we migrate notification channels that do not pass the url validation. As we assume the notification was not being delivered to being with.

* Add a log line when we modify the channel

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
(cherry picked from commit 2448123a65)

* fix tests

Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-10-13 08:51:06 +02:00
Grot (@grafanabot) a652ffa9b4 [v8.2.x] Alerting: Fixes a bug when trying to sync broken alertmanager config (#40342)
* Alerting: Fixes a bug when trying to sync broken alertmanager config (#40338)

* Alerting: Fixes a bug when trying to sync broken alertmanager config

Broken alertmanager configuration has the potential to be introduced as part of a migration e.g. due to incompatible data between what grafana accepts and what the Alertmanager expects. When this happens, we expect an eventually consistent behaviour where we'll keep trying to apply the configuration until it works.

As part of change in https://github.com/grafana/grafana/pull/39237 we introduced a regression that modified this behaviour and instead tried to create a new Alertmanager for that organization everytime, which eventually ended up in a panic due to a duplicate metrics being registered.

This PR fixes that and introduces a test to catch further regressions.

* Remove disable orgs

(cherry picked from commit 48d73cb148)

* remove decryptFn that is not known in 8.2 branch

Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-10-12 15:26:00 -04:00
George Robinson e775fba146 Alerting: Fix error message in ngalert when notifications cannot be sent to alertmanager (#40158) (#40317)
(cherry picked from commit 8318e45452)
2021-10-12 15:28:45 +01:00
Grot (@grafanabot) 128981fb21 Alerting: cleanup alert resources on org removal (#39938) (#40321)
(cherry picked from commit e1dfec49f9)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2021-10-12 12:46:03 +02:00
Giordano Ricci fa4eec8e1d AWS: add OpenSearch to AWS services (#40290) (#40297)
(cherry picked from commit 24af3593a2)
2021-10-11 17:30:08 +02:00
Grot (@grafanabot) 7539dd5ec6 Add Headers to http client Options (#40214) (#40220)
(cherry picked from commit d023cabae6)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
2021-10-08 16:27:07 +02:00
George Robinson 29638a485b Panel ID annotation cannot be set without Dashboard UID (#40019) (#40063)
(cherry picked from commit 935bd34a30)
2021-10-06 12:17:29 +01:00
George Robinson 265714866b You can now get alert rules for a dashboard or a panel using /api/v1/rules endpoints. (#39476) (#40008)
Get alert rules for a dashboard and panel in /api/v1/rules

(cherry picked from commit 2a4c1b1aa6)
2021-10-06 11:38:26 +01:00
Grot (@grafanabot) 73e89da81c Fix static path matching issue in macaron (#40023) (#40027)
Co-authored-by: Malcolm Holmes <mdh@odoko.co.uk>
(cherry picked from commit 329f96db1a)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-10-05 20:04:26 +02:00
Grot (@grafanabot) 218dc8104e AccessControl: rename data source id read action (#39966) (#40009)
(cherry picked from commit 4160429b71)

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2021-10-05 16:09:32 +02:00
Domas b5521a9eaf Alerting: Alertmanager datasource support for upstream Prometheus AM implementation (#39775) (#39989)
(cherry picked from commit a1d4be0700)
2021-10-05 12:13:11 +03:00
Grot (@grafanabot) 32481e75c5 Alerting: make /api/prometheus/grafana/api/v1/rules faster (#39660) (#39986)
(cherry picked from commit e343b62665)

Co-authored-by: Domas <domas.lapinskas@grafana.com>
2021-10-05 11:11:15 +03:00
Kyle Brandt 4be5dd6391 Alerting: Allow more characters in label names so notifications are sent (#38629) (#39965)
Remove validation for labels to be accepted in the Alertmanager, This helps with datasources that produce non-compatible labels.

Adds an "object_matchers" to alert manager routers so we can support labels names with extended characters beyond prometheus/openmetrics. It only does this for the internal Grafana managed Alert Manager.

This requires a change to alert manager, so for now we use grafana/alertmanager which is a slight fork, with the intention of going back to upstream.

The frontend handles the migration of "matchers" -> "object_matchers" when the route is edited and saved. Once this is done, downgrades will not work old versions will not recognize the "object_matchers".

Co-authored-by: Kyle Brandt <kyle@grafana.com>
Co-authored-by: Nathan Rodman <nathanrodman@gmail.com>
(cherry picked from commit 6572017ec7)

cleanup

Co-authored-by: gotjosh <josue@grafana.com>
2021-10-04 09:07:04 -07:00
Grot (@grafanabot) 70a4fd8a21 Plugins Catalog: Make the catalog the default way to interact with plugins (#39779) (#39822)
* chore(Plugins/Admin): make the Plugins Catalog the default way to interact with plugins

* chore(defaults.ini): change the default value for `plugin_admin_enabled`

* test(Plugins): make the tests pass

(cherry picked from commit c2754eb9cc)

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
2021-09-30 09:05:55 +02:00
Sofia Papagiannaki 368742ab04 Alerting: Remove ngalert feature toggle and introduce two new settings for enabling Grafana 8 alerts and disabling them for specific organisations (#38746) (#39793)
* Remove `ngalert` feature toggle

* Update frontend

Remove all references of ngalert feature toggle

* Update docs

* Disable unified alerting for specific orgs

* Add backend tests

* Apply suggestions from code review

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Disabled unified alerting by default

* Ensure backward compatibility with old ngalert feature toggle

* Apply suggestions from code review

Co-authored-by: gotjosh <josue@grafana.com>
(cherry picked from commit 012d4f0905)
2021-09-29 11:21:25 -04:00
Selene d07ed05918 Extract search users functions into a service (#39002) (#39770)
* Extract search users to a new service

* Fix wire provider

* Fix common_test and remove RouteRegister

* Remove old endpoints

* Fix test

* Add indexes to dashboards and orgs tables

* Fix lint

(cherry picked from commit 02702eb82d)
2021-09-29 17:02:58 +02:00
Grot (@grafanabot) 09461d03ea Update migration to not delete existing Grafana alerts (#39541) (#39736)
* keep existing unified alert rules untouched
* move silences and other alertmanager files to the organization directory (only if it is a single organization deployment)
* assign the existing notification settings and routes to the first organization
* create default notification settings for each organization in the case of multi org deployment

(cherry picked from commit 5d0d7dcb3a)

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2021-09-29 09:27:44 -04:00