Alexander Emelin
32b74e75a3
live: various code cleanups ( #37165 )
2021-07-23 19:47:08 +03:00
George Robinson
2f4c893cf3
Expand the value string in annotations and labels of alerts ( #37051 )
...
This commit makes it possible to use the value string in
annotations and labels for alerts with "{{ $value }}"
2021-07-22 15:20:44 +01:00
yuwaMSFT2
ad1f792b8b
Auth: Pass user role to Grafana using auth proxy ( #36729 )
...
* Pass role to Grafana using auth proxy
By default, the role will be applied to the default org of the user.
If the request uses the standard header "X-Grafana-Org-Id", the role will be applied to the specified org
Tested in both unit test and manually E2E
* Address comment: only allow the user role to be applied to the default org
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-07-22 15:49:58 +02:00
Sofia Papagiannaki
b96dd1877c
Folder API: optionally force deleting Grafana 8 alerts when deleting a folder (or error) ( #36427 )
...
* Folder API: Add an optional query parameter for allowing deleting a folder containing rules
* Update frontend
- Set forceDeleteRules=true when frontend deletes a folder
- Improve modal text
* Update docs
* Apply suggestions from code review
Co-authored-by: gotjosh <josue@grafana.com>
Co-authored-by: Nathan Rodman <nathanrodman@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-07-22 12:27:13 +03:00
Sofia Papagiannaki
7815ed511f
Alerting: Refactor API endpoints for fetching alert rules ( #37055 )
...
* Refactor ruler API endpoint for listing rules
* Refactor prometheus API endpoint for listing rules
* Update HTTP API docs
2021-07-22 09:53:14 +03:00
Maksim Nabokikh
ec9a587cbe
Provisioning: Improve validation by validating across all dashboard providers ( #26742 )
...
* Provisioning: check sanity across all dashboard readers
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Apply suggestions from code review
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Refactor of duplicateValidator and fix issues according to commentaries
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Apply suggestions from code review
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove newDuplicateEntries function
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Change folderUid in logs to folderUID
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Restrict write access for readers, which are provisioning duplicate dashboards
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Fix file reader after rebasing onto master
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Apply suggestions from code review
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Format file_reader
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Apply suggestions from code review
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Apply suggestions from code review
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix lint problem
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
* Apply suggestions from code review
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-07-21 17:52:41 +02:00
Alexander Emelin
6c440b5e8b
live: handle input with NaN sent as a string ( #36924 )
2021-07-20 10:46:05 +03:00
David Parrott
fa0bed7118
do not over write alerting rule duration ( #36930 )
2021-07-20 11:49:35 +05:30
Djairho Geuens
4cadbba686
Email: Allow configuration of content types for email notifications ( #34530 )
...
* Alerting: Allow configuration of content types for email notifications
* Fix lint error
* Improves email templates
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve code comments
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve email template
* Remove unnecessary predeclaration
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Adds handling for unrecognized content type
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Move utility function outside of util package
* Fixes syntax
* Remove unused package
* Fix lint error
* improve email templates
* Fix test
* Alerting: Allow configuration of content types for email notifications
* Fix lint error
* Improves email templates
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve code comments
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve email template
* Remove unnecessary predeclaration
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Adds handling for unrecognized content type
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Move utility function outside of util package
* Fixes syntax
* Remove unused package
* Fix lint error
* improve email templates
* Fix test
* Fix comment style
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
* Fix template formatting
* Add test and improve error handling
* Fix test
* Fix formatting
* Fix formatting
* Improve documentation and regenerates txt template
* Update docs/sources/administration/configuration.md
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Djairho Geuens <djairho.geuens@ae.be>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-07-19 13:31:51 +03:00
Sofia Papagiannaki
f308ba91e3
Alerting: Improve receiver initialisation errors ( #36814 )
...
* Alerting: Improve receiver initialisation errors
2021-07-19 11:58:35 +03:00
Alexander Emelin
37caebc934
live: handle origin without port set ( #36834 )
2021-07-17 13:38:33 +03:00
Sofia Papagiannaki
afe6e793ff
Alerting: deactivate an Alertmanager configuration ( #36794 )
...
* Alerting: deactivate an Alertmanager configuration
Implement DELETE /api/alertmanager/grafana/config/api/v1/alerts
by storing the default configuration which stops existing cnfiguration
from being in use.
* Apply suggestions from code review
2021-07-16 20:07:31 +03:00
Marcus Efraimsson
11d03f7961
Chore: Use context.Context for the get home dashboard API endpoint ( #36735 )
...
Use context.Context for the get home dashboard API endpoint.
Ref #36734
2021-07-16 12:40:03 +02:00
Selene
1c74bb3992
UsageStats: Extend usage stats for count permissions in folders and dashborads ( #36065 )
...
* Add usage stats for permissions for dashboards and folders
* Change double quotes for simple ones
2021-07-16 10:14:33 +02:00
George Robinson
456dac1303
Expand the value of math and reduce expressions in annotations and labels ( #36611 )
...
* Expand the value of math and reduce expressions in annotations and labels
This commit makes it possible to use the values of reduce and math
expressions in annotations and labels via their RefIDs. It uses the
Stringer interface to ensure that "{{ $values.A }}" still prints the
value in decimal format while also making the labels for each RefID
available with "{{ $values.A.Labels }}" and the float64 value with
"{{ $values.A.Value }}"
2021-07-15 13:10:56 +01:00
David Parrott
19f18bcecc
Alerting: annotation on state change ( #36535 )
...
* WIP
* Add annotation on alert state change
* move annotation creation to manager
* praise the linter!
* add debug msg when creating annotation
2021-07-13 09:50:10 -07:00
Alexander Emelin
607c5d2555
Live: handle influx input with incomplete/asymmetrical field set ( #36664 )
2021-07-13 19:17:59 +03:00
David Parrott
310d3ebe3d
change template expansion missing value handling ( #36679 )
2021-07-13 06:57:18 -07:00
Kevin Song
0b95fd8ae6
Legacy Alerting: Replace simplejson with a struct in webhook notification channel ( #34952 )
...
* Add type for webhook body
* Update pkg/services/alerting/notifiers/webhook.go
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2021-07-13 15:14:04 +03:00
Ganesh Vernekar
8efe1856e2
Alerting: A better and cleaner way to know if Alertmanager is initialised ( #36659 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-12 18:53:01 +05:30
Ganesh Vernekar
e19c690426
Alerting: Fix potential panic in Alertmanager when starting up ( #36562 )
...
* Alerting: Fix potential panic in Alertmanager when starting up
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
* Fix reviews
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-12 11:15:16 +05:30
Alexander Emelin
e1358eeb76
live: better error logging in push API ( #36601 )
2021-07-10 16:46:21 +03:00
Marcus Efraimsson
ca2223f705
Database: Fix incorrect format of isolation level configuration parameter for MySQL ( #36565 )
2021-07-09 19:05:48 +02:00
Andrej Ocenas
ea2ba06b93
CloudWatch/Logs: Fix log alerts in new unified alerting ( #36558 )
...
* Pass FromAlert header from new alerting
* Add better error messages
2021-07-09 13:43:22 +02:00
Ganesh Vernekar
94d2520a84
Alerting: Allow space in label and annotation names ( #36549 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-08 18:26:09 +05:30
Serge Zaitsev
9b2d7d6d69
Gradually remove Macaron web framework ( #36325 )
...
* add macaron code to the code base
* remove unused secure cookies support from macaron
* clean up modules
* remove com dependency
* fix silly typos
* little cleanup, remove recovery middleware
* remove logger middleware
* remove static handler and remove unused context methods
* bring inject into macaron codebase
* remove unused applicator
* add back macaron license
* more cleanups in macaron code
* remove unused injector Set method
* remove unused context methods: param to int conversion, body helper type, cookie helpers
* remove action from context
* remove complex environment handling, we only use Env variable
* restore ReplaceAllParams to fix the tests
2021-07-08 14:19:40 +02:00
Joan López de la Franca Beltran
d9e500b654
UsageStats: Expose what ds types should be reported ( #35916 )
2021-07-07 23:12:00 +02:00
gotjosh
a86ad1190c
Alerting: Refactor state manager as a dependency ( #36513 )
...
* Alerting: Refactor state manager as a dependency
Within the scheduler, the state manager was being passed around a
certain number of functions. I've introduced it as a dependency to keep
the "service" interfaces as clean and homogeneous as possible.
This is relevant, because I'm going to introduce live reload of these
components as part of my next PR and it is better if dependencies are
self-contained.
* remove unused functions
* Fix a few more tests
* Make sure the `stateManager` is declared before the schedule
2021-07-07 17:18:31 +01:00
Sofia Papagiannaki
fc90d47863
Alerting API: Restrict access to Alertmanager configuration ( #36507 )
...
* Alerting API: Restrict access to Alertmanager configuration to viewers
2021-07-07 16:29:18 +03:00
idafurjes
60ac54d969
Chore: Refactor OAuth/social package to service ( #35403 )
...
* Creating SocialService
* Add GetOAuthProviders as socialService method
* Add OAuthTokenService
* Add GetOAuthHttpClient method to SocialService
* Rename services, access socialMap from GetConnector
* Fix tests by mocking oauthtoken methods
* Move NewAuthService into Init
* Move OAuthService to social pkg
* Refactor OAuthService to OAuthProvider
* Fix nil map error, rename file, simplify tests
* Fix bug for Forward OAuth Identify
* Remove file after rebase
2021-07-07 08:54:17 +02:00
Tharun Rajendran
f62bc59688
DataSource: change status code to 404 if datasource and plugin is not found ( #36426 )
...
Fixes #36418
2021-07-05 14:46:34 +02:00
Sofia Papagiannaki
8a3edf280e
Alerting: Fix prometheus API to check folder permissions ( #36301 )
2021-07-05 10:49:14 +03:00
Karl Persson
2fd7031102
Access Control: Add fine-grained access control to explore ( #35883 )
...
* add fixed role for datasource read operations
* Add action for datasource explore
* add authorize middleware to explore index route
* add fgac support for explore navlink
* update hasAccessToExplore to check if accesscontrol is enable and evalute action if it is
* add getExploreRoles to evalute roles based onaccesscontrol, viewersCanEdit and default
* create function to evaluate permissions or using fallback if accesscontrol is disabled
* change hasAccess to prop and derive the value in mapStateToProps
* add test case to ensure buttons is not rendered when user does not have access
* Only hide return with changes button
* remove internal links if user does not have access to explorer
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2021-07-02 14:43:12 +02:00
Dimitris Sotirakis
084c9c8746
Dashboards: Add IsFolder field into models.GetDashboardQuery ( #36214 )
...
* Add IsFolder field into models.GetDashboardQuery
* Reverted folderId - return dummy success when calling get folder with id 0
* Moved condition to upper level - add test
2021-07-01 11:40:38 +03:00
Hugo Häggmark
44c48ecebb
Chore: Replace util.DynMap with structs ( #36332 )
...
* Chore: Replace util.DynMap
* Chore: added comments
2021-07-01 10:23:33 +02:00
Alexander Emelin
483418dbb0
live: add allowed_origins option ( #36318 )
2021-07-01 09:30:09 +03:00
Hugo Häggmark
63f9231de1
Annotations: Adds tags endpoint ( #36199 )
...
* Annotations: Adds tags endpoint
* Chore: fixes sql statement
* Refactor: adds count to the api
* Chore: changes after PR comments
* Refactor: changes after PR comments
2021-06-30 13:42:54 +02:00
Ganesh Vernekar
8fe58fc2e3
Alerting: Add additional newlines to Microsoft Teams notification message where necessary ( #36126 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-24 20:52:00 +05:30
Alexander Emelin
98893c0420
Live: experimental HA with Redis ( #34851 )
2021-06-24 11:07:09 +03:00
Kyle Brandt
19f764739b
Alerting: Change __value__
label to __value_string__
annotation and add ValueString
variable in notifications ( #36032 )
...
* Alerting: Allow __value__ label in notifications
was being removed by removePrivateItems
discoverd in #36020 , but issue is not about that specifically
* __value__ label to __value_string__ annotation
and .ValueString extended property for notifications
2021-06-24 12:45:49 +05:30
Alexander Emelin
5bbf45592e
Live: rely on app url for origin check ( #35983 )
2021-06-23 19:51:03 +03:00
Ganesh Vernekar
9a5c1f06df
Alerting: Template all possible variables in notification channels ( #35749 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-22 15:12:54 +05:30
Sofia Papagiannaki
91cf062d0b
Alerting: fix conflicting folder and dashboard permissions during migration ( #35967 )
...
* Alerting: Fix conflicting user and team permissions
* Avoid duplicate perrmissions
* Fix lint
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-22 12:07:52 +05:30
Carl Bergquist
9ef4c21033
add context to getsignedinUser calls ( #35963 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-06-21 07:51:33 +02:00
Ganesh Vernekar
33d6e11175
Alerting: Decouple default template from channel tests ( #35239 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-21 07:59:09 +05:30
David Parrott
4732f832f7
Alerting: recalculate EndsAt ( #35830 )
...
* setEndsAt
* one more test case
* add should clause to tests
2021-06-17 10:01:46 -07:00
Sofia Papagiannaki
5e534d212c
Alerting: Fix alert permissions migration ( #35869 )
...
* Alerting: Fix alert permissions migration
for MySQL >= 5.7 and PostgreSQL
* Do not use import struct
2021-06-17 15:49:56 +03:00
Marcus Efraimsson
477d4197fb
Chore: Improve save dashboard error messages ( #35780 )
...
Includes panel and dashboard id in alert
extractor errors.
Logs all non-400 dashboard errors.
Fixes #35751
2021-06-16 14:56:55 +02:00
Ganesh Vernekar
dcd4bf1615
Alerting: Fill the empty GeneratorURL ( #35740 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-16 15:34:12 +05:30
Sofia Papagiannaki
e5a5b8e3fe
Alerting: Fix updating alert rule properties with missing/zero values ( #35512 )
...
* Fix deleting labels and annotations
* Add test
* Keep no data and error start if not provided
* Allow setting interval and for to zero during rule updates
2021-06-15 20:55:25 +03:00