Commit Graph

7219 Commits

Author SHA1 Message Date
Serge Zaitsev
84a5910e56
Chore: Remove bus from ngalert (#44465)
* pass notification service down to the notifiers

* add ns to all notifiers

* remove bus from ngalert notifiers

* use smaller interfaces for notificationservice

* attempt to fix the tests

* remove unused struct field

* simplify notification service mock

* trying to resolve issues in the tests

* make linter happy

* make linter even happier

* linter, you are annoying
2022-01-26 16:42:40 +01:00
Gabriel MABILLE
d4f682190f
AccessControl: Implement teams resource service (#43951)
* AccessControl: cover team permissions

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Add background service as a consumer to resource_services

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Define actions in roles.go

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Remove action from accesscontrol model

 Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* As suggested by kalle

* move some changes from branch to the skeleton PR

* Add background service as a consumer to resource_services

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* moving resourceservice to the main wire file pt2

* move team related actions so that they can be reused

* PR feedback

* fix

* typo

* Access Control: adding hooks for team member endpoints (#43991)

* AccessControl: cover team permissions

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Add background service as a consumer to resource_services

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Define actions in roles.go

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Remove action from accesscontrol model

 Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* As suggested by kalle

* add access control to list and add team member endpoint, and hooks for adding team members

* member permission type is 0

* add ID scope for team permission checks

* add more team actions, use Member for member permission name

* protect team member update endpoint with FGAC permissions

* update SQL functions for teams and the corresponding tests

* also protect team member removal endpoint with FGAC permissions and add a hook to permission service

* a few small fixes, provide team permission service to test setup

* AccessControl: cover team permissions

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Add background service as a consumer to resource_services

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Define actions in roles.go

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Remove action from accesscontrol model

 Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* As suggested by kalle

* move some changes from branch to the skeleton PR

* remove resource services from wireexts

* remove unneeded actions

* linting fix

* remove comments

* feedback fixes

* feedback

* simplifying

* remove team member within the same transaction

* fix a mistake with the error

* call the correct sql fction

* linting

* Access control: tests for team member endpoints (#44177)

* tests for team member endpoints

* clean up and fix the tests

* fixing tests take 2

* don't import enterprise test license

* don't import enterprise test license

* remove unused variable

Co-authored-by: gamab <gabi.mabs@gmail.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2022-01-26 14:48:41 +00:00
Morten Nygaard Åsnes
9e4aafa719
MSSQL: Configuration of certificate verification for TLS connection (#31865)
Fixes #24589

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-26 15:00:18 +01:00
Marcus Efraimsson
50fabe8a87
Chore: Implements log15 terminal logger (#44447)
Nicer development/terminal output based on log15 terminal logger.
2022-01-26 12:19:43 +01:00
Mitsuhiro Tanda
d1083b9597
Cloud Monitoring: Reduce request size when listing labels (#44365) 2022-01-26 12:02:42 +01:00
Marcus Efraimsson
7593fc0a20
Provisioning: Fix duplicate validation when multiple organizations have been configured (#44151)
Fix duplicate validation when multiple organizations have been configured. 
This makes sure that all duplicate validation is being made for each organization.

Fixes #44126
2022-01-26 11:33:31 +01:00
Katarina Yang
92ca38bedf
Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in misc files (#43926)
* Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in misc files

* Refactor: Change .inTransaction in org.go file

* Refactor: Update init() to proper SQLStore handlers

* Refactor: Update funcs in tests to be sqlStore methods

* Refactor: Update API funcs to receive HTTPServer

* Fix: define methods on sqlstore

* Adjust GetSignedInUser calls

* Refactor: Add sqlStore to Service struct

* Chore: Add back black spaces to remove file from PR

Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2022-01-25 20:30:08 +01:00
Karl Persson
de2c5783fa
Access Control: Pass db session to hooks (#44428)
* Move hook calls to database and pass session
2022-01-25 17:12:00 +01:00
Marcus Efraimsson
9ab9fd802b
OAuth: Fix parsing of ID token if header contains non-string value (#44159)
Fixes #41111
2022-01-25 17:09:35 +01:00
Will Browne
124bf413a2
make plugin loading for nested plugins more deterministic (#44330) 2022-01-25 16:05:12 +01:00
Marcus Efraimsson
62b69a0b90
Revert "Search: Fix only searching for folder id zero (#44175)" (#44424)
This reverts commit 007cd144a9 from #44175.
2022-01-25 15:04:26 +01:00
Sergey Kostrukov
cb09162cde
Datasources: Simplify the AzureCredentials structure in datasource config (#39209)
Related #35857

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-25 14:23:32 +01:00
Alex Khomenko
aead2e9157
Navigation: allow adding extra content (#44048)
* Add PRO badge

* Allow adding extra content

* Add extra content for the new navbar

* Use highlight text instead of extra content

* Trigger extra events

* Remove ExtraContent

* Update public/app/core/components/NavBar/NavFeatureHighlight.tsx

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>

* Remove redundant i

* Add UpgradeBox

* Move highlight to menu trigger

* Clear navbar next

* Cleanup

* Fix UpgradeBox styles

* Add arrow icon

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2022-01-25 10:04:44 +02:00
idafurjes
dbb2d3af73
Chore: Fix attribute value (#44368)
* Fix attribute value

* Fix also the value for opentracing
2022-01-24 18:17:39 +01:00
Igor Suleymanov
fdeaf7a5c4
Add nil checks to HTTP request validation dispatch (#44371)
Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>
2022-01-24 16:43:44 +01:00
Agnès Toulet
65bdb3a899
FeatureFlags: Revert managing feature flags outside of settings.Cfg (#44382)
* Revert "FeatureToggles: register all enterprise feature toggles (#44336)"

This reverts commit f53b3fb007.

* Revert "FeatureFlags: manage feature flags outside of settings.Cfg (#43692)"

This reverts commit f94c0decbd.
2022-01-24 16:08:05 +01:00
Guilherme Caulada
29268483c2
HTTPServer: Implement named middlewares (#44231)
* Implement named middlewares on http server

* Fix minor ordering issue with named middlewares
2022-01-24 10:41:18 -03:00
Gábor Farkas
9161f9d2e1
prometheus: added json-loading benchmark (#44309) 2022-01-24 14:39:26 +01:00
idafurjes
00c389933b
Chore: Remove bus from team (#44218)
* Remove bus from team

* Fix api team test

* Remove bus from team members
2022-01-24 11:52:35 +01:00
Gábor Farkas
0f8b0dc301
prometheus: refactor test (#44358) 2022-01-24 11:08:41 +01:00
Jeff Levin
c8154b9fe2
Datasource API: #32556 resolve readonly datasources can be modified (#44186)
* Check if datasource is read-only when making an update
* Standardize api returning a 404 if datasource is not found while making an update

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>, Jesse Weaver<pianohacker@gmail.com>
2022-01-21 14:22:43 -09:00
Ryan McKinley
f53b3fb007
FeatureToggles: register all enterprise feature toggles (#44336) 2022-01-21 20:36:28 +01:00
Marius Bezuidenhout
9fc0aee02b
Feature/mathandreduce (#41608)
* Added new math functions: round, ceil, floor 
* Added a new reduce function: last.
2022-01-21 13:15:50 -05:00
Yuriy Tseretyan
ce0ef0ef5e
create only one folder per dashboard with acl (#44283) 2022-01-21 10:24:41 -05:00
Jean-Philippe Quéméner
8ee3f59cd4
Alerting: recognize Cortex datasources correctly in the frontend (#44316)
* Alerting: always use msg field for user facing errors

* fix: revert front-end Cortex detection

Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
2022-01-21 15:44:11 +01:00
Marcus Efraimsson
007cd144a9
Search: Fix only searching for folder id zero (#44175)
Fixes so that searching for folder id zero in folder/dashboard search returns 
dashboards located in the general folder and not including all folders as it 
did before.

Fixes #40273
2022-01-21 13:51:58 +01:00
Will Browne
da98ebdcdf
Plugins: Remove old code related to Core plugin installs (#44311)
* remove old code

* remove even more

* skip flaky test
2022-01-21 13:38:04 +01:00
Will Browne
3cb0fb3ddc
fix and add test (#44286) 2022-01-21 11:00:20 +01:00
Ryan McKinley
f94c0decbd
FeatureFlags: manage feature flags outside of settings.Cfg (#43692) 2022-01-20 13:42:05 -08:00
Will Browne
7fbc7d019a
Plugins: Core plugins register via backend factory provider (#43171)
* refactoring store interface and init flow

* fix import

* fix linter

* refactor resource calling

* load with class

* re-order args

* fix tests

* fix linter

* remove old creator

* add custom config struct

* fix some tests

* cleanup

* fix

* tackle plugins

* fix linter

* refactor and fix test

* add connect failure error

* add fix for azure, cloud monitoring and test data

* restructure

* remove unused err

* add fake tracer for test

* fix grafana ds plugin
2022-01-20 18:16:22 +01:00
Eric Leijonmarck
9ccc7ec76e
Serviceaccounts: convert selection of apikeys to serviceaccounts (#44154)
* convert selected of apikeys to serviceaccounts

* update to use one by one

* expose endpoint of service account
2022-01-20 16:51:18 +01:00
Isabella Siu
2c3bed1f4b
CloudWatch: remove unused "live" log code (#44185) 2022-01-20 08:58:39 -05:00
idafurjes
30aa24a183
Chore: Implement OpenTelemtry in Grafana (#42674)
* Separate Tracer interface to TracerService and Tracer

* Fix lint

* Fix:Make it possible to start spans for both opentracing and opentelemetry in ds proxy

* Add span methods, use span interface for rest of tracing

* Fix logs in tracing

* Fix tests that are related to tracing

* Fix resourcepermissions test

* Fix some tests

* Fix more tests

* Add TracingService to wire cli runner

* Remove GlobalTracer from bus

* Renaming test function

* Remove GlobalTracer from TSDB

* Replace GlobalTracer in api

* Adjust tests to the InitializeForTests func

* Remove GlobalTracer from services

* Remove GlobalTracer

* Remove bus.NewTest

* Remove Tracer interface

* Add InitializeForBus

* Simplify tests

* Clean up tests

* Rename TracerService to Tracer

* Update pkg/middleware/request_tracing.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Initialize tracer before passing it to SQLStore initialization in commands

* Remove tests for opentracing

* Set span attributes correctly, remove unnecessary trace initiliazation form test

* Add tracer instance to newSQLStore

* Fix changes due to rebase

* Add modified tracing middleware test

* Fix opentracing implementation tags

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-20 11:10:12 +01:00
Katarina Yang
61974383d7
Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in alert files (#43815)
* Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in alert files

* Fix: Revert second SaveAlerts back to normal func

* Refactor: Update tests so functions are now SQLStore methods

* Fix: Refactor pauseAlert and pauseAllAlerts to be SQLStore methods

* Fix: Refactor SaveAlerts to be SQLStore method

* Refactor: Update SaveAlerts func signature to have correct arguments

* Refactor: Define sqlStore

* Chore: Delete commented out code

* Chore: Remove unused SaveAlertsCommand
2022-01-19 19:25:52 +00:00
Eric Leijonmarck
bf4c217b95
Serviceaccounts: refactor list using server admin page (#44122)
* refactor: use server admin listing serviceaccounts

Co-authored-by: Jguer <joao.guerreiro@grafana.com>

* setup route for specifc service account

* add routes to index

* main issue with spelling mistakes

* feat: make routes /serviceacconts/id for navModel

Co-authored-by: Jguer <joao.guerreiro@grafana.com>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

* Update pkg/services/serviceaccounts/manager/service.go

Co-authored-by: Jguer <joao.guerreiro@grafana.com>
Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
2022-01-19 17:03:45 +01:00
J Guerreiro
7dab52869e
ServiceAccounts: Add detail view of service account (#44164)
* ServiceAccounts: Add detail view of service account

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>

* ServiceAccount: Make detail view scopeID

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>

* ServiceAccount: fix lint error

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>
2022-01-19 10:23:46 +01:00
Dessen Xu
8917e66eb4
Fix kiosk bug (#43152)
* fix_kiosk_bug

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
2022-01-19 10:58:22 +02:00
Jeremy Price
6ae7b0c3b2
Accesscontrol: list tokens for service account (#43809)
* Add list tokens endpoint

* Update api.go

Co-authored-by: J Guerreiro <joao.guerreiro@grafana.com>
2022-01-19 09:55:38 +01:00
Gabriel MABILLE
54280fc9d7
AccessControl: Resolve attribute based scopes to id based scopes (#40742)
* AccessControl: POC scope attribute resolution

Refactor based on ScopeMutators

test errors and calls to cache

Add comments to tests

Rename logger

Create keywordMutator only once

* AccessControl: Add AttributeScopeResolver registration

Co-authored-by: gamab <gabriel.mabille@grafana.com>

* AccessControl: Add AttributeScopeResolver to datasources

Co-authored-by: gamab <gabriel.mabille@grafana.com>

* Test evaluation with translation

* fix imports

* AccessControl: Test attribute resolver

* Fix trailing white space

* Make ScopeResolver public for enterprise redefine

* Handle wildcard

Co-authored-by: Jguer <joao.guerreiro@grafana.com>

Co-authored-by: jguer <joao.guerreiro@grafana.com>
2022-01-18 17:34:35 +01:00
Dimitris Sotirakis
c1ba0afdc7
GetUserInfo: Return an error if no user was found (#44169)
* return an error if no user was found

* Update database.go

Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
2022-01-18 17:03:16 +01:00
Andres Martinez Gotor
4e1c7e868e
Cloudwatch: use the backend HTTP client provider (#44036) 2022-01-18 09:34:12 +01:00
Piotr Jamróz
9fb8339f87
Elastic: Allow using long/int as date field for alerts (#44027)
* Use integers for time range filter

Previously it was passed as a string which is automatically converted by Elastic to a number only if the field type is "date". For other types (e.g. "long") such conversion doesn't work. In theory "date" could be passed as a formatted string but we don't use it this way and always pass it as a number so it is safe to always pass numbers, not strings.

* Fix time_series_query_test

* Retrigger build
2022-01-17 15:45:09 +01:00
Ivana Huckova
e704110f74
Prometheus: Fix interpolation of $__rate_interval variable (#44035)
* Name fields based on targets length

* Remove rounding in rate interval variable replacing

* Refactor and fix edge  case when interval and time duration would be rate interval

* Add tests

* Remove , from test

* Revert "Name fields based on targets length"

This reverts commit 5dcb34a765.
2022-01-17 15:32:23 +01:00
Will Browne
a65ce992c1
fix delete plugin dashboard (#44055) 2022-01-17 10:33:42 +01:00
Karl Persson
f75e4d1a4f
Access Control: Allow signed in users access to GET data sources endpoints (#43338)
* remove scopes from endpoints and add datasources:read without scope to
the compatibility role
2022-01-17 10:16:12 +01:00
ying-jeanne
7422789ec7
Remove Macaron ParamsInt64 function from code base (#43810)
* draft commit

* change all calls

* Compilation errors
2022-01-15 00:55:57 +08:00
Will Browne
7694fff0ef
[WIP] Plugins: Refactoring backend initialization flow (#42247)
* refactoring store interface and init flow

* fix import

* fix linter

* refactor resource calling

* load with class

* re-order args

* fix tests

* fix linter

* remove old creator

* add custom config struct

* fix some tests

* cleanup

* fix linter

* add connect failure error

* remove unused err

* convert test over
2022-01-14 13:30:39 +01:00
J Guerreiro
1e9818a69f
Add usage stats preview endpoint (#43899)
* Stats: add preview route for usage statistics

* Stats: respect reporting settings

* Stats: add tests to api endpoint

* Stats: unregister route

* Stats: always possible to preview stats

* Update pkg/infra/usagestats/service/api.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2022-01-14 10:16:07 +01:00
Gábor Farkas
bedc5cccaa
prometheus: fix auto-inserting null-timestamps at the end (#44022) 2022-01-14 09:25:15 +01:00
Alexander Weaver
c68eefd398
Alerting: Add abstraction layer and testing hooks in front of SMTP dialer (#43875)
* Add abstraction layer above SMTP communication

* Fix issues with attachments and sync command

* Tests for bad SMTP behavior

* Separate tests between async and sync entry points. Test difference between them

* Return interface so Wire can properly map types

* Address feedback from George
2022-01-13 15:19:15 -06:00