Commit Graph

7190 Commits

Author SHA1 Message Date
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
Yuriy Tseretyan
8114f6b065
Use stack trace context in XORM trace logger (#43780)
* add caller and stack Valuer functions
* Add WithPrefix and WithSuffix similar to what go-kit offers
* replace New with just `with`. Remove filter wrapper because the first argument of the context argument is not logger but additional context.
* update Xorm logger to use custom depth to display the datastore code instead of xorm
2022-01-13 13:30:28 -05:00
Emil Tullstedt
25736b6afb
Auth: implement auto_sign_up for auth.jwt (#43502)
Co-authored-by: James Brown <jbrown@easypost.com>
2022-01-13 17:15:22 +01:00
Karl Persson
f999910dc6
Access control: Add access control sql filter to org user queries (#43961)
* Add access control SQL filter to org user queries
2022-01-13 14:40:32 +01:00
Eric Leijonmarck
ccd9e46dda
changed route on the serviceaccounts endpoint (#43989)
* changed route on the serviceaccounts endpoint

* refactor: change to base url variable

* tests fixed
2022-01-13 14:15:43 +01:00
Gábor Farkas
4a88b8f66c
Prometheus: add tests covering the prometheus-response to dataframes conversion (#43892)
* prometheus: add tests covering prometheus_response to grafana_dataframes

* fixed variable name

* added comment

* removed not-helping function call
2022-01-13 11:52:50 +01:00
Victor Marin
f881fd1637
Postgres/MySQL/MSSQL: Cancel in-flight SQL query if user cancels query in grafana (#43890) 2022-01-12 16:24:27 +02:00
Jeremy Price
e894837b7e
Accesscontrol: Remove service account creation code from addapikey (#43900)
* Remove service account creation code from addapikey
Co-authored-by: J Guerreiro <joao.guerreiro@grafana.com>
2022-01-12 15:18:57 +01:00
Eric Leijonmarck
6409e761b5
List serviceaccounts (#43672)
* Serviceaccounts: feat - tabview for serviceaccounts

* WIP

* feat: listing all service accounts

* refactor: needed to remove showInvitees as not present in serviceaccounts

* add token column in the list

* add token to orgserviceaccount

* Update pkg/services/serviceaccounts/api/api.go
2022-01-12 13:23:00 +01:00
Ashley Harrison
1966eba796
Chore: Add some e2e tests for repeating behaviour (#43457)
* user essentials mob! 🔱

* user essentials mob! 🔱

* WIP: Mob session work 🚧 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* mob next [ci-skip] [ci skip] [skip ci]

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* 🚧: Mob session work 🔱

* user essentials mob! 🔱

* user essentials mob! 🔱

* Move repeats suite under dashboard suite

* remove these generated files

* move repeats-suite into dashboards-suite

* Reexport dashboard jsons from play and update them

* 🚧: Mob session work 🔱

* 🚧: Mob session work 🔱

* Rename dashboards to work with stripnulls

* Run stripnulls

* Add repeat to row schema

* Clean up the rest of the repeating dashboards

* Fix tooltip sorting

* Update older dashboards

* Update golden files so tests pass

* format this to ensure consistent tabs/spaces

* undo whitespace changes

* Update scripts/stripnulls.sh

Co-authored-by: sam boyer <sam.boyer@grafana.com>

* update schema versions and test

Co-authored-by: thisisobate <obasiuche62@gmail.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: kay delaney <kay@grafana.com>
Co-authored-by: Alexandra Vargas <alexa1866@gmail.com>
Co-authored-by: sam boyer <sam.boyer@grafana.com>
2022-01-11 16:47:30 +00:00
Sofia Papagiannaki
963ae4ef87
API: Fix storing dashboard with static UID (#43861)
* API: Fix storing dashboard with static UID
2022-01-11 18:39:53 +02:00
Yuriy Tseretyan
ed5c664e4a
Alerting: Stop firing of alert when it is updated (#39975)
* Update API to call the scheduler to remove\update an alert rule. When a rule is updated by a user, the scheduler will remove the currently firing alert instances and clean up the state cache. 
* Update evaluation loop in the scheduler to support one more channel that is used to communicate updates to it.
* Improved rule deletion from the internal registry. 
* Move alert rule version from the internal registry (structure alertRuleInfo) closer rule evaluation loop (to evaluation task structure), which will make the registry values immutable.
* Extract notification code to a separate function to reuse in update flow.
2022-01-11 11:39:34 -05:00
Marcus Efraimsson
f6414ea2b2
CodeQL: Try to fix uncontrolled data used in path expression (#43462)
Ref #43080
2022-01-11 17:37:58 +01:00
Ieva
a06564fb0d
Access control: allow granting a fixed role dynamically based on the startup settings (#43867)
* allow granting a fixed role dynamically depending on startup config

* move role definition for team writing

* undo test changes

* nicer naming
2022-01-11 11:58:40 +01:00
Ieva
41b709d08d
Access control: permissions for team creation (#43506)
* FGAC for team creation

* tests

* fix snapshot for UI tests

* linting

* update snapshots

* Remove unecessary class and update tests

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

* Make the condition slightly easier

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

Co-authored-by: gamab <gabi.mabs@gmail.com>
2022-01-10 17:05:53 +00:00
Katarina Yang
5bab02c7ef
Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactional… (#43823)
* Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in user files

* update milesone
2022-01-10 11:28:41 -05:00
Ryan McKinley
b404aae9c3
Crawler: use existing render service to generate dashboard thumbnails (#43515)
Co-authored-by: Artur Wierzbicki <artur@arturwierzbicki.com>
2022-01-10 08:21:35 -08:00
Karl Persson
d350ed0f35
Access Control: SQL filter (#43560)
* Add the accesscontrol sql filter utility

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-01-10 14:26:57 +01:00
Karl Persson
0003bf7cc2
AzureAD OAuth: Add support for fetching user groups (#43470)
* Add functionallity to extractGroups to handle groups-overage claims
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-01-10 11:50:10 +01:00
Dominik Prokop
1a0f5595c3
TimeSeries/BarChart: Add support for sorting series in the tooltip (#43615)
* TimeSeries panel: Add support for sorting series in the tooltip

* Fix cue tests

* Make sortValues work with string values

* Sort values in DatHoverView and remove sort index from TooltipPlugin

* Rename sortOrder prop to sort

* DataHoverView - use raw values for sorting
2022-01-10 10:32:21 +01:00
Dan Cech
34f757ba5a
switch to using featureEnabled for enterprise features (#41559)
* switch to using featureEnabled for enterprise features
2022-01-07 15:11:23 -05:00
Travis Patterson
9eb82f9fff
Propagate all headers (#43812)
* Propagate all headers

* stable header order
2022-01-07 12:45:26 -07:00
Ryan McKinley
546818819b
Loki: use queryType rather than range|instant flags (#43727) 2022-01-07 10:00:11 -08:00
Katarina Yang
a30ca86084
Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactional… (#43772)
* Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in dashboard

* Fix: Fix failing lint and BE tests
2022-01-07 17:50:59 +01:00
Joan López de la Franca Beltran
532e71554f
Usage Stats: Add metrics to count enabled kms providers per kind (#43640)
* Usage Insights: Add metrics to count enabled kms providers per kind

* Add backwards compatibility
2022-01-07 13:52:28 +01:00
Selene
32ed680fc2
Team Guardian: Refactor it to remove the bus dependency (#43058)
* Refactor team guardian to avoid to use bus

* Fix lint

* Fix lint
2022-01-07 13:38:00 +01:00
Emil Tullstedt
fdd196a627
Datemath: Remove unused functions (#43665) 2022-01-07 12:53:31 +01:00
Yuriy Tseretyan
ea478dec22
Alerting: Remove bridge between log15 and go-kit logger (#43769)
* remove bridge between log15 and go-kit logger.

* fix tests
2022-01-07 09:40:09 +01:00
Katarina Yang
7f8daa0eae
Refactor: Change sqlstore.inTransaction to .WithTransactionalDBSession (#43245)
* Refactor: Change sqlstore.inTransaction(...) to SQLStore.WithTransactionalDBSession(...) in alert_notification.go

* Chore: Fix BE lint err

* fix: fix failing sqlstore nil error

* chore: remove unecessary setup()

* fix: use appropriate ctx
2022-01-06 18:21:39 +01:00
ying-jeanne
a8eef45a44
Logger migration from log15 to gokit/log (#41636)
* migrate log15 to gokit/log

* fix console log

* update some unittest

* fix all unittest

* fix the build

* Update pkg/infra/log/log.go

Co-authored-by: Yuriy Tseretyan <tceretian@gmail.com>

* general type vector

* correct the level key

Co-authored-by: Yuriy Tseretyan <tceretian@gmail.com>
2022-01-06 22:28:05 +08:00