Commit Graph

34 Commits

Author SHA1 Message Date
Serge Zaitsev 76e30c5e97 Chore: Refactor alerting notifier tests to remove goconvey (#40758) 2021-10-21 17:04:43 +02:00
Joan López de la Franca Beltran 722c414fef Encryption: Refactor securejsondata.SecureJsonData to stop relying on global functions (#38865)
* Encryption: Add support to encrypt/decrypt sjd

* Add datasources.Service as a proxy to datasources db operations

* Encrypt ds.SecureJsonData before calling SQLStore

* Move ds cache code into ds service

* Fix tlsmanager tests

* Fix pluginproxy tests

* Remove some securejsondata.GetEncryptedJsonData usages

* Add pluginsettings.Service as a proxy for plugin settings db operations

* Add AlertNotificationService as a proxy for alert notification db operations

* Remove some securejsondata.GetEncryptedJsonData usages

* Remove more securejsondata.GetEncryptedJsonData usages

* Fix lint errors

* Minor fixes

* Remove encryption global functions usages from ngalert

* Fix lint errors

* Minor fixes

* Minor fixes

* Remove securejsondata.DecryptedValue usage

* Refactor the refactor

* Remove securejsondata.DecryptedValue usage

* Move securejsondata to migrations package

* Move securejsondata to migrations package

* Minor fix

* Fix integration test

* Fix integration tests

* Undo undesired changes

* Fix tests

* Add context.Context into encryption methods

* Fix tests

* Fix tests

* Fix tests

* Trigger CI

* Fix test

* Add names to params of encryption service interface

* Remove bus from CacheServiceImpl

* Add logging

* Add keys to logger

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

* Add missing key to logger

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

* Undo changes in markdown files

* Fix formatting

* Add context to secrets service

* Rename decryptSecureJsonData to decryptSecureJsonDataFn

* Name args in GetDecryptedValueFn

* Add template back to NewAlertmanagerNotifier

* Copy GetDecryptedValueFn to ngalert

* Add logging to pluginsettings

* Fix pluginsettings test

Co-authored-by: Tania B <yalyna.ts@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2021-10-07 17:33:50 +03:00
Joan López de la Franca Beltran 6415d2802e Plugins: Requests validator (#30445)
* Introduce PluginRequestValidator abstraction with a NoOp implementation

* Update PluginRequestValidator abstraction to use the dsURL instead

* Inject PluginRequestValidator into the HTTPServer and validate requests going through data source proxy

* Inject PluginRequestValidator into the BackendPluginManager and validate requests going through it

* Validate requests going through QueryMetrics & QueryMetricsV2

* Validate BackendPluginManager health requests

* Fix backend plugins manager tests

* Validate requests going through alerting service

* Fix tests

* fix tests

* goimports

Co-authored-by: Leonard Gram <leo@xlson.com>
2021-02-03 20:47:45 +01:00
Arve Knudsen 07582a8e85 Chore: Fix various spelling errors in back-end code (#25241)
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
Sofia Papagiannaki 388d3d3714 Notification is sent when state changes from no_data to ok (#18920) 2019-09-05 18:54:27 +03:00
Carl Bergquist bfa7c3d963 alerting: golint fixes for alert notifiers. (#17167) 2019-05-20 15:23:06 +02:00
Carl Bergquist f001815d9d alerting: no notification when going from nodata -> pending (#16905)
ref #16496
2019-05-07 10:34:00 +02:00
Pavel Bakulev f132e929ce Added uid for alert notifications 2019-01-16 16:50:00 +02:00
bergquist 8fb997d935 should not notify when going from unknown to pending 2018-11-14 23:43:09 +01:00
bergquist d25284a364 introduce state unknown for rules that have not been evaluated yet 2018-11-05 10:50:28 +01:00
bergquist 70385119bc removes d in disableResolvedMessage 2018-10-17 10:41:18 +02:00
Dave Waters c4dcf5a4ee fix gofmt, add test, correct noted concerns with default value 2018-10-16 17:33:38 -04:00
bergquist 9289cba625 merges defaultShouldNotify and ShouldNotify 2018-10-02 14:28:48 +02:00
bergquist 7f1d7cefc0 reminder: uses UpdatedAt to track state changes. 2018-10-02 11:19:09 +02:00
Marcus Efraimsson 5ec086dc56 don't notify if notification state pending
If notification state is pending and last update of state was made
less than a minute ago. In the case of a grafana instance is shut down/crashes
between setting pending state and before sending the notification/marks as complete
this logic should allow the notification to be sent after some time instead of
being left in an inconsistent state where no notifications are being sent.
2018-09-30 21:52:50 +02:00
Marcus Efraimsson 8551ffa0b0 alert -> ok with reminders enabled should send 2018-09-28 18:34:20 +02:00
Marcus Efraimsson c1763508e0 handle pending and completed state for alert notifications 2018-09-28 14:22:03 +02:00
Leonard Gram 1a75aa54de wip: impl so that get alertstate also creates it if it does not exist 2018-09-28 10:48:08 +02:00
bergquist ff79f80685 initial rename refactoring 2018-09-27 09:43:00 +02:00
bergquist b04052f515 alerting: move all notification conditions to defaultShouldNotify 2018-09-26 14:34:10 +02:00
bergquist 396f8e6464 notifications: read without tran, write with tran 2018-06-29 15:15:31 +02:00
bergquist 8ff538be07 notifier: handle known error first 2018-06-26 14:13:45 +02:00
bergquist c21938d4c4 use epoch to compare timestamp 2018-06-16 00:03:13 +02:00
bergquist 12bf5c225a tests for defaultShouldNotify 2018-06-15 16:27:20 +02:00
bergquist f4b089d551 notifications: make journaling ctx aware 2018-06-15 15:30:17 +02:00
bergquist 7333d7b8d4 alerting: invert sendOnce to sendReminder 2018-06-05 10:44:17 +02:00
John Baublitz fca97535d1 Fix multiple bugs 2018-06-04 13:19:14 +02:00
bergquist d29563ff8e alerting: bad default state for notifiers
when we made image upload optional we didnt
show the default value properly in the UI. Which
caused confusing. This commit apply the default
values to existing notifiers in the edit pages
and reverts back to using uploadimage=true as the
default value.
2018-03-28 12:52:39 +02:00
Thibault Chataigner fd633a1d5d Add a per-notifier ShouldNotify()
This way we are able to edit notification behavior per notifier.
This would be usefull to let some notifiers send notifications,
even when the state doesn't change, or with custom condition.

Signed-off-by: Thibault Chataigner <t.chataigner@criteo.com>
2017-12-12 17:35:54 +01:00
bergquist ded5a0a9d5 tech(alerting): remove unused code 2016-10-21 09:05:54 +02:00
Torkel Ödegaard f5809c0209 fix(build): trying to fix build 2016-09-13 20:14:18 +02:00
Torkel Ödegaard 8c30babdf1 feat(alerting): fixed build issues 2016-09-13 16:24:00 +02:00
Torkel Ödegaard b0c7e61ef8 feat(alerting): removed severity 2016-09-13 15:09:55 +02:00
bergquist 55b560a4a8 feat(alerting): filter notifications based on severity
closes #5851
2016-09-06 14:27:48 +02:00