Commit Graph

154 Commits

Author SHA1 Message Date
Hugo Häggmark 3d41267fc4
Chore: Moves common and response into separate packages (#30298)
* Chore: moves common and response into separate packages

* Chore: moves common and response into separate packages

* Update pkg/api/utils/common.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: changes after PR comments

* Chore: move wrap to routing package

* Chore: move functions in common to response package

* Chore: move functions in common to response package

* Chore: formats imports

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-01-15 14:43:20 +01:00
Carl Bergquist cffc1b13ad
adds tracing for all bus calls that passes ctx (#29434)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-27 14:58:45 +01:00
Arve Knudsen 294770f411
Chore: Handle wrapped errors (#29223)
* Chore: Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 13:34:28 +01:00
jgulick48 5bc6c447e3
Alerting: Return proper status code when trying to create alert notification channel with duplicate name or uid (#28043)
* Alerting: Return proper status code when trying to create an Alert Notification where the name or UID already exists.

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-20 13:53:48 +02:00
Arve Knudsen a5d9196a53
Chore/fix lint issues (#27704)
* Chore: Fix linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-22 16:22:19 +02:00
Agnès Toulet 0c4b7d3f5d
Alerting API: send 404 not found error and enrich delete with UID endpoint response with alert notification ID (#27550)
* Alerting API: Send back 404 not found error for update and delete endpoints

* Alerting API: send back alert notification id for delete with uid endpoint
2020-09-11 18:04:43 +02:00
Mitsuhiro Tanda 292c985b76
Alerting: Support storing sensitive notifier settings securely/encrypted (#25114)
Support storing sensitive notification settings securely/encrypted.
Move slack notifier url and api token to secure settings.
Migrating slack notifier to store token and url encrypted is currently 
a manual process by saving an existing slack alert notification channel.
saving an existing slack alert notification channel will reset the stored 
non-secure url and token.

Closes #25113
Ref #25967

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-07-08 10:17:05 +02:00
vikkyomkar 3866f609ce API: Added alert state validation before changing its state (#21375)
* added alert state validation before changing its state

* modified boolean condition

* converted most occurring string into const

* referred the const of alert models
2020-01-09 11:18:51 +01:00
Marcus Efraimsson 8fd153edb7
API: Restrict anonymous user information access (#18422)
Existing /api/alert-notifications now requires at least editor access.
Existing /api/alert-notifiers now requires at least editor access.
New /api/alert-notifications/lookup returns less information than
/api/alert-notifications and can be access by any authenticated user.
Existing /api/org/users now requires org admin role.
New /api/org/users/lookup returns less information than
/api/org/users and can be access by users that are org admins,
admin in any folder or admin of any team.
UserPicker component now uses /api/org/users/lookup instead
of /api/org/users.

Fixes #17318
2019-08-12 20:03:48 +02:00
Carl Bergquist d8736a2547
Alerting: golint fixes for alerting (#17246) 2019-06-03 10:25:58 +02:00
Marcus Efraimsson 5da1faf454
Alerting: Notification channel http api fixes (#16379)
Fixes so it's possible to create new notification channel and providing uid.
Fixes better error/result handling when updating a notifcation channel.

Fixes #16372
Ref #16219 #16012
2019-04-04 17:52:40 +02:00
Marcus Efraimsson 2ae63e70c0
Alerting: Notification channel http api enhancements (#16219)
Now returns uid in response to get notification channel by id.
Adds GET/PUT/DELETE support for notification channel by uid, 
  /api/alert-notifications/uid/:uid.
Break apart alerting and alert notification http api docs in two 
  pages and update documentation to make it up to date
  with current implementation.

Fixes #16012
2019-03-26 18:37:02 +07:00
Sofia Papagiannaki 8def73ba13 Fix Error 500 on unexisting /api/alert-notification/<id> 2019-01-13 21:30:20 +02:00
Carl Bergquist 6049855dc7
Merge pull request #13947 from bergquist/alerting_for
Introduce alert debouncing
2018-11-19 10:38:02 +01:00
Marcus Efraimsson 9e0da02b6a
refactor dashboard alert extractor 2018-11-05 14:25:19 +01:00
bergquist d25284a364 introduce state `unknown` for rules that have not been evaluated yet 2018-11-05 10:50:28 +01:00
bergquist 93124f38fa alerting: only check frequency when not send once 2018-06-04 22:19:27 +02:00
bergquist 0e647db485 Merge branch 'master' into alerting_reminder
* master: (30 commits)
  changelog: add notes about closing #11882
  renamed variable in tests
  added comment, variableChange -> variableValueChange
  added a test
  added if to check if new variable has been added
  Gravatar fallback does not respect 'AppSubUrl'-setting (#12149)
  change admin password after first login
  changelog: adds note about closing #11958
  revert: reverted singlestat panel position change PR #12004
  Revert "provisioning: turn relative symlinked path into absolut paths"
  provisioning: turn relative symlinked path into absolut paths
  changelog: adds note about closing #11670
  elasticsearch: sort bucket keys to fix issue wth response parser tests
  docs: what's new in v5.2
  changelog: add notes about closing #11167
  docs: docker secrets support. (#12141)
  alerting: show alerts for user with Viewer role
  datasource: added option no-direct-access to ds-http-settings diretive, closes #12138
  provisioning: adds fallback if evalsymlink/abs fails
  tests: uses different paths depending on os
  ...
2018-06-04 17:44:18 +02:00
John Baublitz fca97535d1 Fix multiple bugs 2018-06-04 13:19:14 +02:00
Alexander Zobnin 13c6f37ea5
alerting: show alerts for user with Viewer role
changelog: add notes about closing #11167

remove changelog note

reformat alert_test.go
2018-06-04 12:34:30 +03:00
Patrick O'Carroll 0c269d64d0 Alert panel filters (#11712)
alert list panel: filter alerts by name, dashboard, folder, tags
2018-06-01 14:36:40 +02:00
Julian Kornberger 0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger 7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Dan Cech c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech 338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
Marcus Efraimsson 53cd39fde5 Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900)
* dashboards: new command for validating dashboard before update

Removes validation logic from saveDashboard and later on use the new command for validating
dashboard before saving a dashboard. This due to the fact that we need to validate permissions
for overwriting other dashboards by uid and title.

* dashboards: use the new command for validating dashboard before saving

Had to refactor dashboard provisioning a bit to be able to sidetrack the permission validation
in a somewhat reasonable way.
Adds some initial tests of the dashboard repository, but needs to be extended later. At least
now you can mock the dashboard guardian

* dashboards: removes validation logic in the save dashboard api layer

Use the dashboard repository solely for create/update dashboards and let it do all
the validation. One exception regarding quota validation which still is in api layer
since that logic is in a macaron middleware.
Need to move out-commented api tests later.

* dashboards: fix database tests for validate and saving dashboards

* dashboards: rename dashboard repository to dashboard service

Split the old dashboard repository interface in two new interfaces, IDashboardService and
IDashboardProvisioningService. Makes it more explicit when using it from the provisioning package
and there's no possibility of calling an incorrect method for saving a dashboard.

* database: make the InitTestDB function available to use from other packages

* dashboards: rename ValidateDashboardForUpdateCommand and some refactoring

* dashboards: integration tests of dashboard service

* dashboard: fix sqlstore test due to folder exist validation

* dashboards: move dashboard service integration tests to sqlstore package

Had to move it to the sqlstore package due to concurrency problems when running
against mysql and postgres. Using InitTestDB from two packages added conflicts
when clearing and running migrations on the test database

* dashboards: refactor how to find id to be used for save permission check

* dashboards: remove duplicated dashboard tests

* dashboards: cleanup dashboard service integration tests

* dashboards: handle save dashboard errors and return correct http status

* fix: remove log statement

* dashboards: import dashboard should use dashboard service

Had to move alerting commands to models package due to problems with import cycles of packages.

* dashboards: cleanup dashboard api tests and add some tests for post dashboard

* dashboards: rename dashboard service interfaces

* dashboards: rename dashboard guardian interface
2018-02-19 11:12:56 +01:00
Torkel Ödegaard 5323971c21
refactoring: alert rule query refactoring (#10941) 2018-02-16 13:56:04 +01:00
Torkel Ödegaard 07fa2f1722
fix: alert list links did not work, changed dashboardUri to Url, this is breaking api change in alert api (#10756) 2018-02-05 09:42:41 +01:00
bergquist fcd86fb24f make it easier for dashboards to generate ur; 2018-02-01 14:08:51 +01:00
bergquist 74ca6f6dbf changes dashboard url in alertlist 2018-02-01 14:08:51 +01:00
Daniel Lee 79fe01959b alerting: small refactoring 2018-01-31 10:47:31 +01:00
Daniel Lee eb765d288c alertlist: disable pause button when user does not have permission 2018-01-30 23:35:27 +01:00
Daniel Lee f5107d5023 alerting: add permission check in api for pausing alerts 2018-01-30 14:41:25 +01:00
Torkel Ödegaard 029317ed18 tech: alert list react migration progress 2017-12-31 14:16:19 +01:00
Torkel Ödegaard 9cce5217d0 build: fixed gofmt issue and addd mock response feature 2017-10-23 09:57:28 +02:00
Torkel Ödegaard 1fd2270a93 build: split circle test shell scripts 2017-10-23 09:06:50 +02:00
Torkel Ödegaard 87c978ebc9 fix: better error handling / messsage when testing email notification when stmp is not configured, fixes #8093 2017-04-25 13:16:41 +02:00
bergquist e78da57e4d feat(alerting): shows when no_data triggered alerts
closes #7035
ref #7257
2017-01-17 09:49:25 +01:00
bergquist 0873d493c2 feat(alerting): moves getNewState to evalHandler
closes #7149
2017-01-13 11:02:24 +01:00
Torkel Ödegaard b8f559aecb feat(plugins): made notifiers more pluggable and easier to support many of them, new ones can now be added without modifying any existing file, #7162 2017-01-06 12:04:25 +01:00
bergquist 9a3e51894b tech(alerting): remove unused property 2017-01-03 08:11:17 +01:00
bergquist a230ff65a9 fix(alerting): typo 2016-12-19 16:44:59 +01:00
bergquist 6c2c3c7e24 Revert "fix(alerting): pause dto can only pause one"
This reverts commit b2c5a6a037.
2016-12-19 16:07:55 +01:00
bergquist b2c5a6a037 fix(alerting): pause dto can only pause one 2016-12-19 16:05:24 +01:00
bergquist a2257ec3d0 tech(alerting): renames pause all method 2016-12-19 15:17:49 +01:00
bergquist ecdf1888c4 feat(alerting): removes pause per datasource 2016-12-19 13:24:45 +01:00
bergquist 4ef95cfd31 style(api): reduce code complexity 2016-12-16 16:07:23 +01:00
bergquist 1f8f3ed038 style(api): extracts filter logic for mass pause 2016-12-16 15:19:13 +01:00
bergquist fb6aa0e026 feat(api): adds endpoint for mass pausing alerts
ref #6589
2016-12-16 15:00:58 +01:00
Torkel Ödegaard 773fb5d1ae fix(alerting): check if dashboard is saved before testing alert rule, fixes #6549 2016-11-23 14:55:10 +01:00
Torkel Ödegaard 62e8a039a1 refactor(alerting): refactoring PR for OR conditions, #6579 2016-11-17 15:48:15 +01:00
utkarshcmu 690868c837 Added firingEvalution to Rule test 2016-11-17 01:28:17 -08:00
Torkel Ödegaard 2d19af601a fix(alerting): various alerting fixes 2016-11-06 15:40:02 +01:00
utkarshcmu 7490c49f60 Alert un paused to pending state 2016-11-01 07:58:38 -07:00
Torkel Ödegaard 30645a6d3d refactor(alerting): initial step for seperating alerting and dash model, #6273 2016-10-14 13:06:29 +02:00
bergquist c6cf7647ff feat(alerting): pausing alerts requires alert id 2016-10-11 10:53:24 +02:00
bergquist 4bbc2108f9 feat(alerting): add pause button to alert list 2016-10-11 09:45:38 +02:00
bergquist 804797245d feat(alerting): make it possible to pause from alert tab 2016-10-11 08:40:38 +02:00
bergquist f3825263d4 feat(alerting): add pause button in alert list 2016-10-10 15:17:14 +02:00
bergquist 264590a9c2 feat(alerting): add paused api endpoint 2016-10-10 14:26:09 +02:00
Torkel Ödegaard 7c339f0794 feat(alerting): show alertin state in panel header, closes #6136 2016-09-30 17:37:47 +02:00
bergquist 9dd8b3b408 wip 2016-09-14 14:12:19 +02:00
bergquist d0f9623037 feat(alertlistpanel): support state filter
ref #5981
2016-09-14 10:49:05 +02:00
Torkel Ödegaard b0c7e61ef8 feat(alerting): removed severity 2016-09-13 15:09:55 +02:00
Torkel Ödegaard d60bd77658 feat(annotations): added support to show grafana stored annotations in graphs, #5982 2016-09-08 11:25:45 +02:00
bergquist 2ca7284a56 tech(notifications): splitt into 3 queries
closes #5883
2016-09-06 08:43:15 +02:00
bergquist c893e5d241 feat(notifications): add support for default notifications
ref #5883
2016-09-05 21:35:37 +02:00
bergquist d11bc57c37 feat(notifications): make it possible to send test alert notifications
closes #5847
2016-09-05 14:45:15 +02:00
bergquist 11a4ff0f8a feat(alerting): add basic UI for history in alert tab
ref #5850
2016-08-30 13:22:59 +02:00
bergquist 650a87dc05 feat(alerting): add alert history api endpoint
ref #5850
2016-08-30 09:32:56 +02:00
Torkel Ödegaard 5cf9711862 feat(alerting): added eval match to test results 2016-08-18 11:22:24 +02:00
Torkel Ödegaard f934081bcb feat(alerting): making progress on alerting list, #5784 2016-08-16 09:52:45 +02:00
bergquist 16e75a3036 feat(alerting): add alert message to slack integration 2016-08-12 10:12:04 +02:00
Torkel Ödegaard 717cce014b feat(alerting): refactoring 2016-07-27 17:07:44 +02:00
Torkel Ödegaard 0d9b98da6d feat(alerting): progress on email notifications 2016-07-26 12:29:52 +02:00
Torkel Ödegaard a6c6094775 feat(alerting): started reworking notifications 2016-07-22 16:45:17 +02:00
Torkel Ödegaard 7eb2d2cf47 feat(alerting): working on state management 2016-07-22 13:14:09 +02:00
Torkel Ödegaard f6a160b270 feat(alerting): testing alert is starting to work 2016-07-21 13:09:12 +02:00
Torkel Ödegaard 9e91aacd34 feat(alerting): progress on testing alerts 2016-07-21 10:29:11 +02:00
Torkel Ödegaard fb636344a6 feat(alerting): began work on testing alert rule from UI without having to save it 2016-07-20 16:13:36 +02:00
Torkel Ödegaard 624cd6fc0a feat(alerting): cleanup, removed alert changes table and code 2016-07-13 11:58:55 +02:00
bergquist 48e1a17ac2 feat(alerting): remove dummie values from email notifier 2016-06-23 16:30:12 +02:00
bergquist 488b42377b feat(alerting): update state if not been updated for 15min 2016-06-23 11:03:27 +02:00
bergquist 0c5da9155f feat(alerting): only expose DTO info when requesting all notifications 2016-06-20 11:31:20 +02:00
bergquist b907ce341c feat(alerting): enables deletes for alert notifications 2016-06-16 15:21:44 +02:00
bergquist 7f767224af feat(alerting): basic support for creating and updating notifications 2016-06-16 14:29:20 +02:00
bergquist a3b7ea7704 feat(alerting): skeleton for alert notification configuration page 2016-06-16 08:16:16 +02:00
Torkel Ödegaard a362984c57 feat(alerting): renamed AlertRuleModel to just Alert, think making a distinction between an Alert and an Alert Rule is just confusing and was a mistake on my part 2016-06-11 10:26:48 +02:00
bergquist fdf051ad5a feat(alerting): begin alert rule storage refactoring 2016-06-09 22:21:28 +02:00
Torkel Ödegaard 34e17f7282 feat(alerting): requests looks to be working again 2016-06-06 17:11:46 +02:00
bergquist 077be210da tech(alerting): change interval -> frequency 2016-05-30 09:31:05 +02:00
bergquist 1bb8bc58b8 feat(alerting): add parameteters for filtering alerts 2016-05-10 09:45:56 +02:00
bergquist 1be513fabd feat(alerting): add support for alert page filter 2016-05-09 14:44:44 +02:00
bergquist 47070f2d1f chore(alerting): struct names and url refactoring 2016-05-09 11:25:21 +02:00
bergquist 26941284da feat(alerting): add limit and since id options for alert logs 2016-05-04 09:57:53 +02:00
bergquist bac89775e2 tech(alerting): fixes broken refactoring 2016-05-02 18:00:10 +02:00
bergquist 743a6fa37c feat(alerting): add support for deleting alert rules 2016-05-02 16:07:19 +02:00
bergquist f442adca47 feat(alerting): adds api endpoints for alerts per dashboard and panel 2016-04-28 15:13:42 +02:00
bergquist 0f0fa0c257 feat(alerting): adds endpoint for getting alert states log 2016-04-28 10:59:46 +02:00
bergquist 3ecc13506c feat(alerting): adds alert state go ui 2016-04-28 08:53:34 +02:00