Commit Graph

52 Commits

Author SHA1 Message Date
Thibault Chataigner
e06abb30aa Alerting: Add tags to alert rules (#10989)
Ref #6552
2019-06-06 13:29:30 +02:00
Oleg Gaidarenko
54c1bf0cc9
Chore: a bit of spring cleaning (#16710)
* Chore: use early return technic everywhere

And enable "indent-error-flow" revive rule

* Chore: remove if-return rule from revive config

* Chore: improve error messages

And enable "error-strings" revive rule

* Chore: enable "error-naming" revive rule

* Chore: make linter happy

* Chore: do not duplicate gofmt execution

* Chore: make linter happy

* Chore: address the pull review comments
2019-04-23 11:24:47 +03: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
ccd89eee97 renames debouceduration to for 2018-11-05 11:05:30 +01:00
bergquist
d25284a364 introduce state unknown for rules that have not been evaluated yet 2018-11-05 10:50:28 +01:00
bergquist
2d3a575489 adds db migration for debounce_duration 2018-11-05 10:50:28 +01:00
bergquist
75f832cda8 use alert state changes counter as secondary version 2018-10-01 15:58:30 +02: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
Karsten Weiss
b7adf28501 Remove redundancy in variable declarations (golint)
This commit fixes the following golint warnings:
pkg/api/avatar/avatar.go:229:12: should omit type *http.Client from declaration of var client; it will be inferred from the right-hand side
pkg/login/brute_force_login_protection.go:13:26: should omit type time.Duration from declaration of var loginAttemptsWindow; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:58:26: should omit type []string from declaration of var metricCategoryPrefix; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:69:22: should omit type []string from declaration of var trimMetricPrefix; it will be inferred from the right-hand side
pkg/models/alert.go:37:36: should omit type error from declaration of var ErrCannotChangeStateOnPausedAlert; it will be inferred from the right-hand side
pkg/models/alert.go:38:36: should omit type error from declaration of var ErrRequiresNewState; it will be inferred from the right-hand side
pkg/models/datasource.go:61:28: should omit type map[string]bool from declaration of var knownDatasourcePlugins; it will be inferred from the right-hand side
pkg/plugins/update_checker.go:16:13: should omit type http.Client from declaration of var httpClient; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:103:24: should omit type time.Duration from declaration of var unfinishedWorkTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:105:19: should omit type time.Duration from declaration of var alertTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:106:19: should omit type int from declaration of var alertMaxAttempts; it will be inferred from the right-hand side
pkg/services/alerting/notifier.go:143:23: should omit type map[string]*NotifierPlugin from declaration of var notifierFactories; it will be inferred from the right-hand side
pkg/services/alerting/rule.go:136:24: should omit type map[string]ConditionFactory from declaration of var conditionFactories; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:12:15: should omit type []string from declaration of var defaultTypes; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:13:15: should omit type []string from declaration of var rangedTypes; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/opsgenie.go:44:19: should omit type string from declaration of var opsgenieAlertURL; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/pagerduty.go:43:23: should omit type string from declaration of var pagerdutyEventApiUrl; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/telegram.go:21:17: should omit type string from declaration of var telegramApiUrl; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:11:24: should omit type string from declaration of var simpleDashboardConfig; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:12:24: should omit type string from declaration of var oldVersion; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:13:24: should omit type string from declaration of var brokenConfigs; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:22:30: should omit type time.Duration from declaration of var checkDiskForChangesInterval; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:24:23: should omit type error from declaration of var ErrFolderNameMissing; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:15:34: should omit type string from declaration of var twoDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:16:34: should omit type string from declaration of var twoDatasourcesConfigPurgeOthers; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:17:34: should omit type string from declaration of var doubleDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:18:34: should omit type string from declaration of var allProperties; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:19:34: should omit type string from declaration of var versionZero; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:20:34: should omit type string from declaration of var brokenYaml; it will be inferred from the right-hand side
pkg/services/sqlstore/stats.go:16:25: should omit type time.Duration from declaration of var activeUserTimeLimit; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:69:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:70:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:95:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:96:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/setting/setting.go:42:15: should omit type string from declaration of var Env; it will be inferred from the right-hand side
pkg/setting/setting.go:161:18: should omit type bool from declaration of var LdapAllowSignup; it will be inferred from the right-hand side
pkg/setting/setting.go:473:30: should omit type bool from declaration of var skipStaticRootValidation; it will be inferred from the right-hand side
pkg/tsdb/interval.go:14:21: should omit type time.Duration from declaration of var defaultMinInterval; it will be inferred from the right-hand side
pkg/tsdb/interval.go:15:21: should omit type time.Duration from declaration of var year; it will be inferred from the right-hand side
pkg/tsdb/interval.go:16:21: should omit type time.Duration from declaration of var day; it will be inferred from the right-hand side
pkg/tsdb/cloudwatch/credentials.go:26:24: should omit type map[string]cache from declaration of var awsCredentialCache; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:15:27: should omit type *regexp.Regexp from declaration of var regexpOperatorPattern; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:16:27: should omit type *regexp.Regexp from declaration of var regexpMeasurementPattern; it will be inferred from the right-hand side
pkg/tsdb/mssql/mssql_test.go:25:14: should omit type string from declaration of var serverIP; it will be inferred from the right-hand side
2018-04-27 22:14:36 +02: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
Daniel Lee
f5107d5023 alerting: add permission check in api for pausing alerts 2018-01-30 14:41:25 +01:00
bergquist
00dddca26a alerting: dedupe alert notifications when running multiple servers
alert notifications will only be sent if the database value
is updated.

ref #6957
2017-02-21 16:54:49 +01:00
bergquist
9a3e51894b tech(alerting): remove unused property 2017-01-03 08:11:17 +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
ecdf1888c4 feat(alerting): removes pause per datasource 2016-12-19 13:24:45 +01:00
bergquist
fb6aa0e026 feat(api): adds endpoint for mass pausing alerts
ref #6589
2016-12-16 15:00:58 +01:00
bergquist
ca7baca21d feat(alerting): adds ok as no data option
closes #6866
2016-12-15 11:13:19 +01:00
bergquist
489f087fbd feat(alerting): reduce states. Make exeuction result configurable.
ref #6444
2016-11-07 12:42:39 +01:00
utkarshcmu
d9f2519916 Renamed Initialized to Pending 2016-11-01 07:30:55 -07:00
utkarshcmu
4c64e45a59 Added initalized state to alerts 2016-10-28 14:44:45 -07:00
Carl Bergquist
bc90e6ce46 Alerting: Keep last state on no data (#6354)
* feat(alerting): add support to keep last state on no data

closes #6332

* refactoring(alerting PR #6354): added new option type for NoData option so AlertStateType does not have to contain invalid state, #6354
2016-10-22 10:56:04 +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
a23b7f1371 fix(alerting): add missing evaldata field to set state command 2016-09-14 14:35:05 +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
fbae6abb3c feat(alerting): progress on handling no data in alert query, #5860 2016-09-06 20:40:12 +02:00
Torkel Ödegaard
09cdf3e9e1 feat(alerting): show execution errors in alert list 2016-08-18 11:37:35 +02:00
Torkel Ödegaard
63a283b4bc feat(alerting): working on alert state filters for alert list 2016-08-17 11:00:00 +02:00
bergquist
6497b307c4 feat(alerting): save execution error upon state changed 2016-08-17 09:27:29 +02:00
bergquist
9915f15ed0 feat(alerting): adds sql layer for saving execution errors 2016-08-17 07:49:14 +02:00
Torkel Ödegaard
f934081bcb feat(alerting): making progress on alerting list, #5784 2016-08-16 09:52:45 +02:00
Torkel Ödegaard
0392fde34e feat(alerting): doing schema changes 2016-08-15 15:12:43 +02:00
bergquist
16e75a3036 feat(alerting): add alert message to slack integration 2016-08-12 10:12:04 +02:00
Torkel Ödegaard
357358898d feat(annotations): working on alert annotations, #5694 2016-08-01 10:07:00 +02:00
Torkel Ödegaard
7eb2d2cf47 feat(alerting): working on state management 2016-07-22 13:14:09 +02:00
Torkel Ödegaard
f872d5cfa3 feat(alerting): more refactoring work in backend code 2016-07-19 22:36:59 +02:00
Torkel Ödegaard
f13b869aa4 feat(alerting): work on alerting 2016-07-14 13:32:16 +02:00
bergquist
4fc16c36ed feat(alerting): saves new state when alert updates 2016-06-29 00:05:48 +02:00
bergquist
ebada26b85 Merge branch 'alerting' into alerting_notifications 2016-06-17 08:27:58 +02:00
bergquist
e8a324c7f5 feat(alerting): add frequency back to alert model 2016-06-17 08:27:38 +02:00
bergquist
b9b65cf2d4 tech(alerting): add logging about failed notifications 2016-06-16 08:16:16 +02:00
Torkel Ödegaard
dac8b35a1a feat(alerting): renamed scheduler to handler 2016-06-13 15:58:22 +02:00
bergquist
7f22b9eb6e tech(alerting): expression -> settings 2016-06-13 15:18:19 +02:00
bergquist
bb6888885e fix(alerting): makes valid to save more explicit 2016-06-13 15:01:07 +02:00