Commit Graph

3957 Commits

Author SHA1 Message Date
George Robinson
0af09b8c57
Alerting: Add support for images in Line alerts (#50703) 2022-07-21 11:43:06 +02:00
gotjosh
b026f2bc5d
Alerting: Allow the webhook notifier to support a custom Authorization header (#52515)
* Allow the webhook notifier to support a custom Authorization header

Instead of doing something clever of re-using the existing username/password fields of Basic Authentication - I opted for two diffent fields to match the upstream Alertmanager configuration (that in turn is based of the HTTP Basic authentication).

 It'll fail if you have values for both HTTP Basic Authentication and Authorization.
2022-07-21 10:25:58 +01:00
Ieva
f9ef7cac11
allow setting team managed permissions for service accounts (#52467) 2022-07-20 20:27:41 +02:00
Jean-Philippe Quéméner
ba9c18d9c3
Alerting: use static channel configuration to determinate secure fields (#52527)
* Alerting: use static channel configuration to determinate secure fields

* move to channels package

* introduce channel_config package to fix cyclic import

* add missing changes

* compare type to type
2022-07-20 19:58:36 +02:00
Jean-Philippe Quéméner
320262c3db
Alerting: Cleanup the alert_configuration table on write (#51497) 2022-07-20 16:54:18 +02:00
Jean-Philippe Quéméner
50ae42130b
Alerting: take datasources as external alertmanagers into consideration (#52534) 2022-07-20 16:50:49 +02:00
idafurjes
d3d8fdd878
Chore: Move user errors to user service (#52460)
* Move user not found err to user service

* User ErrCaseInsensitive from user pkg

* User ErrUserAlreadyExists from user pkg

* User ErrLastGrafanaAdmin from user pkg

* Remove errors from model
2022-07-20 14:50:06 +02:00
owensmallwood
3bc13e2335
Public Dashboards: Add Public Tag to Dashboard Title (#52351)
Adds Public tag to dashboard title when it has an enabled public dashboard
2022-07-19 17:44:41 -06:00
Michael Mandrus
acd85314b3
Secrets: Add logging to track secrets migration (#52481)
* add logging to track migration

* fix lint problem
2022-07-19 16:36:51 -04:00
Yuriy Tseretyan
79d92aa03e
Alerting: Rename sender.Sender to sender.ExternalAlertmanagers (#52463) 2022-07-19 14:04:48 -04:00
lean.dev
e1785f4eb4
Secret migration from Sql KV Store to Secret Plugin (#52191)
* Created PluginSecretMigrationService to be able to migrate from the secrets table from the database to the secret plugin. Added migration which takes all the secrets at the sql store and stores it in the plugin. Then deletes all the secrets from the sql
* Added secretsKVStoreSQL.GetAll() method to return all the secrets at the sql table
* Renaming kvstore_test.go as sql_test.go, adding GetAll test case. Fixing decryption of keys
2022-07-19 14:42:23 -03:00
George Robinson
094dfd0d4d
Alerting: Fix Slack push notifications (#52391)
This commit fixes push notifications for Slack which used to show "This content cannot be displayed". The text field is shown in both the message and the push notification.
2022-07-19 17:42:24 +01:00
Ryan McKinley
3bdec4d138
Storage: remove orgId from sql config (#52426) 2022-07-19 08:13:26 -07:00
Ezequiel Victorero
e0a58300ac
Public Dashboards: count public dashboards view requests (#52419) 2022-07-19 11:50:37 -03:00
Artur Wierzbicki
0300b1c674
Storage: branding access (#52412)
* Storage: add special users for system branding access

* Storage: explicit global org id

* Storage: initialize org storages with global org id

* Storage: add comments

* Storage: simplify - use orgId: 1 for systembranding
2022-07-19 18:47:11 +04:00
idafurjes
c061b66d5f
Chore: Split delete user method (#52216)
* Remove user from preferences, stars, orguser, team member

* Fix lint

* Add Delete user from org and dashboard acl

* Delete user from user auth

* Add DeleteUser to quota

* Add test files and adjust user auth store

* Rename package in wire for user auth

* Import Quota Service interface in other services

* do the same in tests

* fix lint tests

* Fix tests

* Add some tests

* Rename InsertUser and DeleteUser to InsertOrgUser and DeleteOrgUser

* Rename DeleteUser to DeleteByUser in quota

* changing a method name in few additional places

* Fix in other places

* Fix lint

* Fix tests

* Chore: Split Delete User method

* Add fakes for userauth

* Add mock for access control Delete User permossion, use interface

* Use interface for ream guardian

* Add simple fake for dashboard acl

* Add go routines, clean up, use interfaces

* fix lint

* Update pkg/services/user/userimpl/user_test.go

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Update pkg/services/user/userimpl/user_test.go

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Update pkg/services/user/userimpl/user_test.go

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Add wrapper for not service account error

* fix indentation

* Use fmt for error wrapper

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-07-19 16:01:05 +02:00
Ieva
39025bb4cd
add logs to debug failing migration (#52447) 2022-07-19 09:34:49 -04:00
Yuriy Tseretyan
054fe54b03
Alerting: Split Scheduler and AlertRouter tests (#52416)
* move fake FakeExternalAlertmanager to sender package
* move tests from scheduler to router
* update alerts router to have all fields private
* update scheduler tests to use sender mock
2022-07-19 09:32:54 -04:00
Sofia Papagiannaki
e6b9ded949
API: Add service account routes to the swagger (#52398)
* API: Add service account routes to the swagger
2022-07-19 12:52:51 +03:00
Joe Blubaugh
a0f96ed4e1
SQLStore: Support Upserting multiple rows. (#52228)
This will be used to reduce write load when the alerting system writes a
large number of events.
2022-07-19 16:42:48 +08:00
Peter Holmberg
e74c2390de
Alerting: Prevent evaluation if "for" shorter than "evaluate" (#51797)
Co-authored-by: Armand Grillet <armand.grillet@outlook.com>
2022-07-19 10:30:26 +02:00
Joey Tawadrous
11b743ecd9
Traces: Remove serviceMap feature flag (#52375)
* Remove serviceMap feature flag

* Remove import

* Add serviceMap to queryTypeOptions
2022-07-19 08:00:58 +01:00
Ryan McKinley
824f12a993
Storage: Remove storageLocalUpload flag (#52413) 2022-07-18 10:44:42 -07:00
Artur Wierzbicki
841e5ae8ad
Storage: system/branding storage (#51987)
* Storage: add `system` branding storage root, expose `system/branding` subfolder

* Storage: merge
2022-07-18 19:37:22 +04:00
George Robinson
e7feff6d99
Alerting: Move debug log line to where alert rules are updated (#52318) 2022-07-18 11:27:06 -04:00
Ryan McKinley
b3b64e24c2
Export: include section count in status updates (#52368) 2022-07-18 11:03:08 -04:00
Artur Wierzbicki
9afe845d5c
Sanitization: fix log message (#52401) 2022-07-18 06:46:57 -07:00
idafurjes
f5cace8bbd
Rename Acl to ACL (#52342)
* Rename Acl to ACL

* Fix yaml files

* Add xorm tags and fix test
2022-07-18 15:14:58 +02:00
Artur Wierzbicki
b2736ac1fe
Storage: limit the number of uploaded files (#50796)
* #50608: sql file upload quotas

* rename `files_in_sql` to `file`

* merge conflict
2022-07-18 15:24:39 +04:00
Artur Wierzbicki
67ea2da57e
Storage: fix svg upload (#52395) 2022-07-18 06:36:54 -04:00
Sofia Papagiannaki
fb379ae436
Chore: Introduce playlist service (#52252)
* Store: Introduce playlist service

* Integrate playlist service

* Update swagger
2022-07-18 05:26:35 -04:00
Joe Blubaugh
689ae96a0e
Alerting: Refactor API types generation with different names. (#51785)
This changes the API codegen template (controller-api.mustache) to simplify some names. When this package was created, most APIs "forked" to either a Grafana backend implementation or a "Lotex" remote implementation. As we have added APIs it's no longer the case. Provisioning, configuration, and testing APIs do not fork, and we are likely to add additional APIs that don't fork.

This change replaces {{classname}}ForkingService with {{classname}} for interface names, and names the concrete implementation {{classname}}Handler. It changes the implied implementation of a route handler from fork{{nickname}} to handle{{nickname}}. So PrometheusApiForkingService becomes PrometheusApi, ForkedPrometheusApi becomes PrometheusApiHandler and forkRouteGetGrafanaAlertStatuses becomes handleRouteGetGrafanaAlertStatuses

It also renames some files - APIs that do no forking go from forked_{{name}}.go to {{name}}.go and APIs that still fork go from forked_{{name}}.go to forking_{{name}}.go to capture the idea that those files a "doing forking" rather than "are a fork of something."

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>
2022-07-18 03:08:08 -04:00
Joan López de la Franca Beltran
9abe9fa702
Encryption: Expose secrets migrations through HTTP API (#51707)
* Encryption: Move secrets migrations into secrets.Migrator

* Encryption: Refactor secrets.Service initialization

* Encryption: Add support to run secrets migrations even when EE is disabled

* Encryption: Expose secrets migrations through HTTP API

* Update docs

* Fix docs links

* Some adjustments to makes errors explicit through HTTP response
2022-07-18 08:57:58 +02:00
Artur Wierzbicki
6188526e1d
Storage: use static access rules (#52334)
* Storage: use static access rules

* Storage: use static access rules

* Storage: add tests
2022-07-17 22:41:54 +04:00
Scott Lepper
53933972b6
mysql query editor - angular to react (#50343)
mysql conversion to react

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2022-07-15 16:49:24 -04:00
Yuriy Tseretyan
6e1e4a4215
Alerting: Update DbStore to use disabled orgs from the config (#52156)
* update DbStore to use UnifiedAlerting settings
* remove disabled orgs from scheduler and use config in db store instead
* remove test
2022-07-15 14:13:30 -04:00
Joan López de la Franca Beltran
7b40322bbe
Encryption: Add support to run secrets migrations even when EE is disabled (#51705)
* Encryption: Move secrets migrations into secrets.Migrator

* Encryption: Refactor secrets.Service initialization

* Encryption: Add support to run secrets migrations even when EE is disabled

* Init EE providers on-demand (only when needed)

* Add multiple tests + some adjustments

* Apply feedback
2022-07-15 18:33:34 +02:00
Yuriy Tseretyan
a7509ba18b
Alerting: rule evaluation loop's update channel to provide version (#52170)
* handler for update message in rule evaluation routine ignores the message if its version greater or equal.
* replace messages to update the channel if it is not empty
2022-07-15 12:32:52 -04:00
idafurjes
17ec9cac83
Add delete user from other services/stores (#51912)
* Remove user from preferences, stars, orguser, team member

* Fix lint

* Add Delete user from org and dashboard acl

* Delete user from user auth

* Add DeleteUser to quota

* Add test files and adjust user auth store

* Rename package in wire for user auth

* Import Quota Service interface in other services

* do the same in tests

* fix lint tests

* Fix tests

* Add some tests

* Rename InsertUser and DeleteUser to InsertOrgUser and DeleteOrgUser

* Rename DeleteUser to DeleteByUser in quota

* changing a method name in few additional places

* Fix in other places

* Fix lint

* Fix tests

* Rename DeleteOrgUser to DeleteUserFromAll

* Update pkg/services/org/orgimpl/org_test.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* Update pkg/services/preference/prefimpl/inmemory_test.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* Rename Acl to ACL

* Fix wire after merge with main

* Move test to uni test

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-07-15 18:06:44 +02:00
George Robinson
91fd0223a4
Datasources: Allow configuration of the TTL (#52161) 2022-07-15 10:48:52 +01:00
Jo
f3ee57abef
Fix: Choose Lookup params per auth module (#395) (#52312)
Co-authored-by: Karl Persson <kalle.persson@grafana.com>

Fix: Prefer pointer to struct in lookup

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

Fix: user email for ldap

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

Fix: Use only login for lookup in LDAP

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

Fix: use user email for ldap

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

fix remaining test

fix nit picks
2022-07-15 10:21:09 +01:00
Ryan McKinley
da1701ce57
Dashboards: load from storage (#51949) 2022-07-14 15:36:17 -07:00
Joan López de la Franca Beltran
973b3112d7
Encryption: Re-order error check (#52251) 2022-07-14 23:53:43 +02:00
Jean-Philippe Quéméner
41790083d2
Alerting: Add file provisioning for alert rules (#51635) 2022-07-14 23:53:13 +02:00
Yuriy Tseretyan
e5e8747ee9
Alerting: Update state manager to accept reserved labels (#52189)
* add tests for cache getOrCreate
* update ProcessEvalResults to accept extra lables
* extract to getRuleExtraLabels
* move populating of constant rule labels to extra labels
2022-07-14 15:59:59 -04:00
Matthew Jacobson
efa0d90093
Alerting: Fix Teams notifier not failing on 200 response with error (#52254)
Team's webhook API does not always use the status code to communicate errors.
There are cases where it returns 200 and an error message in the body.
For example, 429 - Too Many Requests or when the message is too large.
Instead, what we should be looking for is a response body = "1".

https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-messages-using-curl-and-powershell
2022-07-14 13:15:18 -04:00
Ieva
c851907fc3
Access Control: Fix missing folder permissions (#52153)
* add the migration

* Update pkg/services/sqlstore/migrations/accesscontrol/dashboard_permissions.go

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
2022-07-14 12:01:21 -04:00
Adam Simpson
5d199a40b7
AzureMonitor: Update UI to experimental package (#52123)
* feat: make azure experimental the default

* feat: combine metrics query editor rows

fix: linter errors

* chore: remove test loop for DimensionFields test
2022-07-14 13:07:31 +00:00
Michał Zielonka
b54da68765
Alerting: fix validation of alertmanager template. (#51538)
without setting function map from alertmanager we receive error:
method=PUT path=/api/v1/provisioning/templates/slack.message status=400
level=error msg="invalid object specification: invalid template: template: :1: function \"toUpper\" not defined"

So for validation we should use the same settings as alertmanager do
for templates internally.
2022-07-14 11:54:08 +02:00
George Robinson
34d45977ca
Alerting: Fix bug where state did not change between Alerting and Error (#52204)
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.
2022-07-14 10:53:39 +01:00