Sofia Papagiannaki
7ccb022c03
Alerting: validate condition before updating rulegroup ( #33367 )
...
* Alerting: validate condition before updating rulegroup
* Apply suggestions from code review
2021-04-28 11:31:51 +03:00
Hugo Häggmark
20ee0e9601
LibraryPanels: Adds panel type filter and sorting ( #33425 )
...
* Wip: inital commit
* Chore: updating api
* Refactor: adds description search and sorting
* Refactor: adds panel filtering
* Refactor: limits the height of select
* Tests: updates snapshot
* Refactor: small UI improvements
2021-04-28 09:18:13 +02:00
Kyle Brandt and Ryan McKinley
968935b8b7
TestData: Change predictable csv scenario to multi-series ( #33442 )
...
Allow multiple series in Predictable CSV Wave testdata scenario
Co-authored-by: Ryan McKinley <ryantxu@gmail.com >
2021-04-27 16:35:43 -04:00
Kyle Brandt
b590e95682
AlertingAPI: Change list response query prop ( #33419 )
...
* Alerting: change to full []AlertQuery as json in a string and not just model.
2021-04-27 22:15:00 +02:00
Vardan Torosyan
5bf6d7dad8
Access control: Update evaluator to authorize when at least one of the scopes is a match ( #33393 )
2021-04-27 18:22:18 +02:00
Ganesh Vernekar
467ab124dd
NGAlert: Fix GET for Alertmanager config ( #33379 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-27 20:48:19 +05:30
Alexander Emelin
50795bc760
live: better comment, code style, show disconnect reason ( #33430 )
2021-04-27 17:01:12 +02:00
Kyle Brandt and Sofia Papagiannaki
adcba36d39
AlertingAPI: update swagger json files match datasourceUid change ( #33332 )
...
* update swagger json files match datasourceUid change
underlying change made in https://github.com/grafana/grafana/pull/33282
* Document DatasourceUID field in AlertQuery model
* Run spec generation from inside a docker container
* Generate latest spec
Co-authored-by: Sofia Papagiannaki <sofia@grafana.com >
2021-04-27 16:50:30 +02:00
Alexander Emelin
e6f9f65fdf
Live: use ReqSignedIn middleware for ws routes ( #33381 )
2021-04-27 16:19:36 +02:00
Owen Diehl
86c8eed386
Instrument/ruler api ( #33290 )
...
* ruler api histogram instrumentation
* register ruler metrics
2021-04-27 08:25:32 -04:00
Ganesh Vernekar
be1affe0a4
NGAlert: Fix flaky test ( #33415 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-27 17:03:22 +05:30
Kyle Brandt
f5efe97763
SSE: limit allowed input/output to/from classic conditions ( #33337 )
...
* add tests for graph and specific cases in this pr
2021-04-27 07:22:11 -04:00
Carl Bergquist
58a325a4e4
Instrumentation: Add success rate metrics for email notifications ( #33359 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-04-27 11:15:07 +02:00
Alexander Emelin
2abd9bc3b9
live: rename url param - assume stable schema by default ( #33383 )
2021-04-26 20:46:26 +03:00
Giordano Ricci
c88af6e221
Elasticsearch: Add generic support for template variables ( #32762 )
...
* Elasticsearch: Add generic support for template variables
* format MovingAverage settings as numbers
* Move formatting logic to query builder & forma serial_diff settings as numbers
* modify presence check
* add todo
* minor fixes
* transform string values to numbers
* Move casting logic
* Slightly cleaner implementation
* Add BE tests
* Leverage elastic validation when string doesn't resolve to a numeric value
* move newly introduced test to testify
* add FE query_builder tests
* check error
* Parse values to float instead of int
* Fix tests & ParseFloat bit size
2021-04-26 16:54:23 +01:00
Will Browne
8e6205c107
Plugins: Move plugin installing + uninstalling logic from CLI to plugins package ( #33274 )
...
* move guts from cli to server
* renaming + refactoring
* add pluginsDir arg
* arg fixes
* add support for repo URL override
* add funcs to interface
* use pluginID consistently
* swap args
* pass mandatory grafanaVersion field
* introduce logger interface
* create central logger for CLI
* add infra log wrapper
* re-add log initer step
* remove unused logger
* add checks for uninstalling
* improve debug blue
* make sure to close file
* fix linter issues
* remove space
* improve newline usage
* refactor packaging
* improve logger API
* fix interface func names
* close file and reformat zipslip catch
* handle G305 linter warning
* add helpful debug log
2021-04-26 16:13:40 +02:00
Alexander Emelin
7501a2deb6
Live: pure websocket push endpoint ( #33339 )
2021-04-26 13:17:49 +03:00
Ryan McKinley
693915de35
Live: Simplify live interface ( #33196 )
2021-04-23 23:21:38 +02:00
Ryan McKinley
1dd9e9b184
Live: support a dashboard gitops channel ( #33291 )
2021-04-23 21:55:31 +02:00
David Parrott
788bc2a793
Alerting: refactor state tracker ( #33292 )
...
* set processing time
* merge labels and set on response
* use state cache for adding alerts to rules
* minor cleanup
* add support for NoData and Error results
* rename test
* bring in changes from other PRs tha have been merged
* pr feedback
* add integration test
* close state tracker cleanup on context.Done
* fixup test
* rename state tracker
* set EvaluationDuration on Result
* default labels set as constants
* separate cache and state from manager
* use RWMutex in cache
2021-04-23 21:32:25 +02:00
David Parrott
ca79206498
Alerting: Handle NoData and Error evaluation results ( #33194 )
...
* set processing time
* merge labels and set on response
* use state cache for adding alerts to rules
* minor cleanup
* add support for NoData and Error results
* rename test
* bring in changes from other PRs tha have been merged
* pr feedback
* add integration test
* close state tracker cleanup on context.Done
* fixup test
* not those annotations
2021-04-23 20:47:52 +02:00
Kyle Brandt
5e818146de
Alerting/Expr: New SSE Request/QueryType, alerting move data source UID ( #33282 )
2021-04-23 16:52:32 +02:00
Ganesh Vernekar
659ea20c3c
NGAlert: Run the maintenance cycle for the silences ( #33301 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-23 16:19:03 +02:00
Vardan Torosyan
bf83fb80b7
Access control: Combine permissions through predefined roles ( #33275 )
...
* Access control: Combine permissions through predefined roles
When certain permission is required for built-in role, instead of adding those permissions to the existing predefined roles, we need to have granular predefined roles with those permissions.
* Better copy...
* Adding and fixing tests
* Remove duplicated permission
2021-04-23 15:44:42 +02:00
Ganesh Vernekar
d66a5e65a4
AlertingNG: Add webhook notification channel ( #33229 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-23 18:59:28 +05:30
Ryan McKinley
7627b55ef4
TSDB: add deprecation comments to many tsdb structs ( #33281 )
2021-04-23 03:03:11 +02:00
David Parrott
aa5bdff97d
Call server.Shutdown() as go routine ( #33288 )
...
server.Shutdown() blocks trying to write to s.shutdownFinished in some cases when using a test Grafana instance for a series of integration tests.
See https://github.com/grafana/grafana/blob/master/pkg/server/server.go#L222-L224
2021-04-22 13:23:08 -07:00
Ganesh Vernekar
a0e567f80f
AlertingNG: Add Dingding notification channel ( #32995 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-22 19:30:49 +02:00
Ganesh Vernekar
4ec1edfca3
AlertingNG: Add Teams notification channel ( #32979 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-22 18:16:26 +02:00
Ganesh Vernekar
c9cd7ea701
AlertingNG: Add Telegram notification channel ( #32795 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-22 17:24:59 +02:00
Ganesh Vernekar
0a03d5c29e
AlertingNG: Correctly set StartsAt, EndsAt, UpdatedAt after alert reception ( #33109 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-22 20:42:18 +05:30
Ganesh Vernekar and Josue Abreu
3056f86f76
AlertingNG: Fix TODOs in email notification channel ( #33169 )
...
* AlertingNG: Fix TODOs in email notification channel
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Test fixup
* Remove the receiver field it is not needed for the email notification
Co-authored-by: Josue Abreu <josue@grafana.com >
2021-04-22 10:01:55 -04:00
Arve Knudsen and Dimitris Sotirakis
6408b55a7c
Slack: Use chat.postMessage API by default ( #32511 )
...
* Slack: Use only chat.postMessage API
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Slack: Check for response error
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Slack: Support custom webhook URL
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Simplify
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Rewrite tests to use stdlib
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/alerting/notifiers/slack.go
Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com >
* Clarify URL field name
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix linting issue
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix up new Slack notifier
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Improve tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix lint
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Slack: Make token not required
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Alerting: Send validation errors back to client
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Document how token is required
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Make recipient required when using Slack API
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix field description
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com >
2021-04-22 16:00:21 +02:00
Alexander Zobnin
0e020a40a5
Access control: Fix invite endpoint permissions ( #33262 )
2021-04-22 16:15:57 +03:00
Ganesh Vernekar
6cc7a20789
NGAlert: Remove all pending references to the old API package ( #33269 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-04-22 18:36:32 +05:30
Erik Sundell
743b77771f
fix dimension name ( #33271 )
2021-04-22 15:02:40 +02:00
Alexander Zobnin
dd9f701cd9
Access control: Fix predefined roles ( #33260 )
2021-04-22 12:49:24 +02:00
Alexander Zobnin
a7e721e987
Access control: Make Admin/Users UI working with the permissions ( #33176 )
...
* API: authorize admin/users views
* Render admin/users components based on user's permissions
* Add LDAP permissions (required by admin/user page)
* Extend default admin role by LDAP permissions
* Show/hide LDAP debug views
* Render LDAP debug page if user has access
* Authorize LDAP debug view
* fix permissions definitions
* Add LDAP page permissions
* remove ambiguous permissions check
* Hide logout buttons in sessions table
* Add org/users permissions
* Use org permissions for managing user roles in orgs
* Apply permissions to org/users
* Apply suggestions from review
* Fix tests
* remove scopes from the frontend
* Tweaks according to review
* Handle /invites endpoints
2021-04-22 13:19:41 +03:00
Arve Knudsen and Will Browne
66020b419c
NGAlert: Consolidate on standard errors package ( #33249 )
...
* NGAlert: Don't use pkg/errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/ngalert/notifier/alertmanager.go
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com >
* Fix logging
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com >
2021-04-22 11:18:25 +02:00
Gábor Farkas and dsotirakis
7ff6665ac2
Alerting: InfluxDB: InfluxQL: convert backend-code to use dataframes ( #32950 )
...
* alerting: influxdb: refactor unit-tests
* alerting: influxdb: converted code from timeseries-mode to dataframe-mode
* influxdb: simplify code
* influxdb: better function name
* influxdb: alerting: more tests
* influxdb: alerting: more tests
* influxdb: refactor
* influxdb: improved unit-test
* influxdb: simplified code
* influxdb: refactor reponse-parser code
* influxdb: refactor unit tests
* influxdb: alerting: use nicer names
Co-authored-by: dsotirakis <sotirakis.dim@gmail.com >
2021-04-22 08:43:17 +02:00
Sofia Papagiannaki
b2288f7ef9
[Alerting]: Add alerting endpoint for Query Evaluation ( #33174 )
...
* [Alerting]: Add alerting endpoint for Query Evaluation
* Fix passing down now parameter
* Add validations and test
* Fix eval queries and expressions test
* Add eval tests
2021-04-21 22:44:50 +03:00
gotjosh
de0802cf3b
Alerting: Fixes the integration test currently failing at master ( #33233 )
...
* Alerting: Fixes the integration test currently failing at master
* Skip the state tracker test for now
2021-04-21 14:57:17 -04:00
David Parrott and Ganesh Vernekar
4be1d84f23
Alerting: Enhancements to /rules ( #33085 )
...
* set processing time
* merge labels and set on response
* use state cache for adding alerts to rules
* minor cleanup
* pr feedback
* Do not initialize mutex unnecessarily
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com >
* linter
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com >
2021-04-21 09:30:03 -07:00
Sofia Papagiannaki and gotjosh
87a70af7eb
[Alerting]: Fix updating rule group and add tests ( #33074 )
...
* [Alerting]: Fix updating rule group and add test
* Fix updating rule labels
* Set default values for rule no data and error states
if they are missing
* Add test for updating rule
* Test updating annotations
* Apply suggestions from code review
Co-authored-by: gotjosh <josue@grafana.com >
* add test for posting an unknown rule UID
* Fix alert rule validation and add tests
* Remove org id from PostableGrafanaRule
This field was not used; each rule gets the organisation of the user making
the rerquest
* Update pkg/tests/api/alerting/api_alertmanager_test.go
Co-authored-by: gotjosh <josue@grafana.com >
2021-04-21 17:22:58 +03:00
Will Browne
c37a3bebb7
Plugins: Serve static assets directly instead of through middleware handler ( #32779 )
...
* removed static routes from macaron
* move path src to plugins pkg
* use plugin details
* remove dead code
* fixes
* use clean from std lib
* reformat imports
* remove caching headers + add security checks
* revert using no cache header middleware
* add cache-control headers
* add 404 check
* use new var for subsequent file handling
2021-04-21 15:17:23 +02:00
gamab
a151dfaa04
ProvisioningService: Change the ProvisioningService interface for easier extension ( #32910 )
...
* Made a public constructor in order to instantiate it from the service override
* Removed unused plugins.DataRequestHandler
* Added a Run and RunInitProvisioners methods that can be run from Enterprise
* Adding a mock for Run and RunInitProvisioners as well
2021-04-21 13:41:34 +02:00
Marcus Efraimsson
dd0ba96d7c
Postgres: Fix time group macro when TimescaleDB is enabled and interval is less than a second ( #33153 )
...
Fixing a special case with time group macro when
using TimescaleDB and interval is lower than a second.
Fixes #33124
2021-04-21 12:54:49 +02:00
gotjosh
23c7e7ab60
Alerting: Various fixes for the alerts endpoint ( #33182 )
...
A set of fixes for the GET alert and groups endpoints.
- First, is the fact that the default values where not being for the query params. I've introduced a new method in the Grafana context that allow us to do this.
- Second, is the fact that alerts were never being transitioned to active. To my surprise this is actually done by the inhibitor in the pipeline - if an alert is not muted, or inhibited then it's active.
- Third, I have added an integration test to cover for regressions.
Signed-off-by: Josue Abreu <josue@grafana.com >
2021-04-21 06:34:42 -04:00
Dafydd
0dcd0281ab
Chore: avoid hard-coding IDs in integration tests ( #33152 )
...
* use dynamic user Ids in test
* use dynamic IDs in alert tests
* use dynamic IDs in dashboard test queries
* use dynamic IDs in org test queries
2021-04-21 11:22:46 +03:00
Ryan McKinley
18bbbaf53e
TestData: support boolean and strings in CSV metric response ( #33099 )
2021-04-20 11:17:06 -07:00