Commit Graph

5745 Commits

Author SHA1 Message Date
Peter Holmberg
6118ab415d
Alerting: Next gen Alerting page (#28397)
* create page and sidebar entry

* add components for query editor and definition

* split pane things

* add reducer and action

* implement split pane and update ui actions

* making things pretty

* Unify toolbar

* minor tweak to title prefix and some padding

* can create definitions

* fix default state

* add notificaion channel

* add wrappers to get correct spacing between panes

* include or exclude description

* implement query editor

* start on query result component

* update from master

* some cleanup and remove expressions touch ups

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-12-11 14:49:14 +01:00
Kyle Brandt
67372378ac
Expressions: Field names from refId (#29755)
so one can see which expression data came from when visualizing
2020-12-11 06:59:12 -05:00
Will Browne
a515c54404
Plugins: Add support for signature manifest V2 (#29240)
* add support for signing manifest v2

* add log and fix var name

* shorten comment

* improve comment

* remove unnecessary param

* improve naming

* reformat

* rename var

* refactor test

* remove unnecessary assert

* simplify test requirements

* add more test cases

* address feedback

* revert naming

* flip tracking missing

* fix check

* Trigger Build
2020-12-11 12:57:57 +01:00
Arve Knudsen
e2351f7951
Chore: Configure go-ruleguard via golangci-lint (#28419)
* Chore: Configure go-ruleguard via golangci-lint

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-11 11:45:17 +01:00
Arve Knudsen
12661e8a9d
Move middleware context handler logic to service (#29605)
* middleware: Move context handler to own service

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullsted <sakjur@users.noreply.github.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-12-11 11:44:44 +01:00
Hugo Häggmark
47afe1fa42
PanelLibrary: Adds delete Api (#29741)
* PanelLibrary: Adds delete

* Chore: fixes some comments

* Chore: changes after PR comments

* Refactor: deletes from correct org
2020-12-11 06:08:32 +01:00
Jeremy Alvis
f021f97c31
DataSourceSettings: Add servername field to DataSource TLS config (#29279)
* DataSourceSettings: Add servername field to DataSource TLS config

A DNS lookup URL can be provided in the DataSource URL field in order
to dynamically load balance between multiple instances of a DataSource.
When using mutual TLS, Golang's TLS config implementation checks that
the certificate's common name (< 1.15) or subject alternative name
(>= 1.15) has the same value as the domain being accessed. If the DNS
entry is dynamically generated for a specific environment, the
certificate cannot be generated with a name matching the dynamic
DNS URL. As such, Golang offers a servername field that can be set to
overwrite what value is used when checking against the certificate's
common name (or subject alternative name). Without this change, Skip
TLS Verify must be set to true in order for the DataSource to work,
removing some of the benefits gained by using mutual TLS.

This commit adds the ability to set Grafana's internal Golang TLS config
servername field from the UI or a provisioned DataSource.

The servername field is optional and the existing behavior is retained if
the field is not set.

Co-authored-by: Dana Pruitt <dpruitt@vmware.com>
Co-authored-by: Jeremy Alvis <jalvis@pivotal.io>

* Update docs with PR review changes

Co-authored-by: Jeremy Alvis <jalvis@pivotal.io>
Co-authored-by: Dana Pruitt <dpruitt@vmware.com>

* Update with additional PR requested changes

* Minor updates based on PR change requests

Co-authored-by: Dana Pruitt <dpruitt@vmware.com>
2020-12-10 16:07:05 +01:00
Arve Knudsen
8b21290164
Chore: Disable gosec on certain line (#29382)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-10 11:53:21 +01:00
Domas
70d68c156d
Logging: log frontend errors caught by ErrorBoundary, including component stack (#29345)
* log component stack on error boundary

* test for error boundary

* PR feedback fixes
2020-12-10 10:50:37 +01:00
Domas
7d9a528184
Logging: rate limit fronted logging endpoint (#29272)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2020-12-09 16:22:24 +01:00
Agnès Toulet
924212b42b
API: add Status() to RedirectResponse (#29722) 2020-12-09 15:08:53 +01:00
Hugo Häggmark
941ba1d2f7
PanelLibrary: Adds api and db to create Library/Shared/Reusable Panel (#29642)
* PanelLibrary: Adds panellib table

* Refactor: removes drop table migration

* Refactor: fixes spelling mistake

* Refactor: changes after PR comments

* Refactor: some more renames

* PanelLibrary: Adds api and db to create Library/Shared/Reusable Panel

* Refactor: reverts SqlStore change and uses RegisterOverride instead

* Refactor: fixes lint error

* Refactor: fixes imports

* Refactor: reverts unintentional changes

* Refactor: Adds repository

* Revert "Refactor: Adds repository"

This reverts commit 4c46e8a6c4.

* Refactor: changes after PR comments

* Refactor: Simplfies further

* Chore: fixes linting

* Chore: Changes after PR comments

* Update pkg/services/librarypanels/api.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: fixes import after commited suggestion

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-09 13:10:18 +01:00
Will Browne
31d64d9074
Auth: Add SigV4 header allowlist to reduce chances of verification issues (#29650)
* enforce allowlist

* fix default auth selection

* add Host and comment
2020-12-09 10:45:57 +01:00
Will Browne
3de091edf1
Alerting: Use correct time series name override from frame fields (#29693)
* cater for empty labels and new DisplayNameFromDS field

* simplify

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* increase priority for ds display name

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-08 22:04:05 +01:00
Dafydd
af3c0fe602
Bugfix 29848: Remove annotation_tag entries as part of annotations cleanup (#29534)
closes https://github.com/grafana/grafana/issues/29484
2020-12-08 19:41:35 +01:00
Carl Bergquist
609d61dece
Adds go dep used by an Enterprise feature. (#29645)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-12-08 16:22:24 +01:00
Carl Bergquist
e1d5fc8627
instrumentation: align label name with our other projects (#29514)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-12-08 14:26:07 +01:00
ying-jeanne
9668c172b3
CloudWatch: namespace in search expression should be quoted if match exact is enabled #29109 (#29563) 2020-12-08 12:37:07 +01:00
Kyle Brandt
46d1c99e2c
Expr: fix time unit typo in ds queries (#29668) 2020-12-07 16:14:22 -05:00
Kyle Brandt
311b563c9b
Expr: make reduction nan/null more consistent (#29665) 2020-12-07 15:07:18 -05:00
Kyle Brandt
da32cef4ae
Expr: fix func argument panic (#29663)
would get wrong type for reflect
2020-12-07 13:58:20 -05:00
Kyle Brandt
6d64c603c2
Expr: fix failure to execute due to OrgID (#29653)
* Expr: fix failure to execute due to OrgID
Get orgID from the plugin context, which makes more sense anyways.
makes expressions work again after https://github.com/grafana/grafana/pull/29449 changes.

* Do not save organisation on its alert query model

Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
2020-12-07 10:30:38 -05:00
Tania B
c869ae5791
Support svg embedded favicons in whitelabeling (#29436)
* Fix favicon embedding in whitelabeling

* Fix formatting
2020-12-07 12:23:53 +02:00
Emil Hessman
a5e43535b3
Chore: Rewrite tsdb sql engine test to standard library (#29590)
* Chore: Rewrite tsdb sql engine test to standard library

Signed-off-by: Emil Hessman <emil@hessman.se>
2020-12-07 09:10:33 +01:00
Ryan McKinley
752d4ed941
Cloudwatch: session cache should use UTC consistently (#29627) 2020-12-04 12:44:16 -08:00
Agnès Toulet
d92beeee3d
API: add ID to snapshot API responses (#29600)
* API: add ID to snapshot API responses

* API: update snapshot tests
2020-12-04 16:22:58 +01:00
Torkel Ödegaard
3d6380a0aa
QueryGroup & DataSourceSrv & DataSourcePicker changes simplify usage, error handling and reduce duplication, support for uid (#29542)
* Starting moving more stuff into data source picker

* WIP progress

* Progress on datasource picker rethink

* Things are working now some details to figure out

* Removed commented part

* Complex work on getting data source lists

* Fixed variable support showing correct data sources

* Tried fixing dashboard import but failed

* Fixes

* Fixed import dashboard

* Fixed unit test

* Fixed explore test

* Fixed test

* Fix

* fixed more tests

* fixed more tests

* fixed showing which option is default in picker

* Changed query variable to use data source picker, updated tests and e2e

* Fixed more tests

* Updated snapshots, had wrong typescript version
2020-12-04 14:24:55 +01:00
Arve Knudsen
4e0ad50102
middleware: Make scenario test functions take a testing.T argument (#29564)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-04 11:09:32 +01:00
Emil Hessman
db0fb1e2c1
Chore: Rewrite sqlstore migration test to use standard library (#29589)
Signed-off-by: Emil Hessman <emil@hessman.se>
2020-12-04 09:05:00 +01:00
Emil Hessman
3c1bcc7275
Chore: Rewrite tsdb prometheus test to standard library (#29592)
Signed-off-by: Emil Hessman <emil@hessman.se>
2020-12-04 08:49:39 +01:00
Arve Knudsen
f326b79cc1
Security: Add gosec G304 auditing annotations (#29578)
* Security: Add gosec G304 auditing annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* space

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: bergquist <carl.bergquist@gmail.com>
2020-12-03 22:13:06 +01:00
Emil Hessman
69ac69b7c5
Chore: Rewrite tsdb testdatasource scenarios test to standard library (#29591)
Signed-off-by: Emil Hessman <emil@hessman.se>
2020-12-03 21:31:01 +01:00
Hugo Häggmark
562a1c36b1
PanelLibrary: Adds library_panel table (#29565)
* PanelLibrary: Adds panellib table

* Refactor: removes drop table migration

* Refactor: fixes spelling mistake

* Refactor: changes after PR comments

* Refactor: some more renames
2020-12-03 15:18:10 +01:00
Arve Knudsen
f2b7fbc32a
Chore: Check errors from Close calls (#29562)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-03 10:11:14 +01:00
Arve Knudsen
58dbf96a12
Middleware: Rewrite tests to use standard library (#29535)
* middleware: Rewrite tests to use standard library

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-03 08:28:54 +01:00
Arve Knudsen
752a424e1f
Auth proxy: Return standard error type (#29502)
* Rewrite auth proxy tests to use standard lib

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Auth proxy: Use standard error type

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-02 16:57:16 +01:00
Jack Westbrook
aa70a38391
Dashboards: hide playlist edit functionality from viewers and snapshots link from unauthenticated users (#28992)
* feat: hide snapshots menu item from viewers

* feat(playlists): prevent viewers from creating/editing playlists

* feat: prevent viewers seeing playlist nav link if no playlists

* refactor(playlist): rename isViewer property to canEditPlaylists

* revert(playlists): put back note if viewer and no playlists

* refactor(snapshots): consider admin/editor permission in folders/dashboards for displaying menu item

* feat(snapshots): only show snapshot nav item if user is signed in

* fix(snapshots): revert snapshots to previous state if delete snapshot api error
2020-12-02 15:51:22 +01:00
Carl Bergquist
4edb1364e9
fixes bug with invalid handler name for metrics (#29529)
closes https://github.com/grafana/grafana/issues/29487

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-12-02 13:42:17 +01:00
Arve Knudsen
8d5b0084f1
Middleware: Simplifications (#29491)
* Middleware: Simplify

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* middleware: Rename auth_proxy directory to authproxy

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-02 12:44:51 +01:00
Tomo Wang
d33c4e5e7c
Alarting: fix alarm messages in dingding (Fixes #29470) (#29482) 2020-12-02 11:09:49 +01:00
Sebastian Poxhofer
63c8945db5
AzureMonitor: Unit MilliSeconds naming (#29399) 2020-12-02 10:09:33 +01:00
Hugo Häggmark
1581d04e65
Chore: Adds Panel Library featuretoggle (#29521) 2020-12-02 08:47:04 +01:00
Ryan McKinley
e0dee06252
Live: publish all dashboard changes to a single channel (#29474) 2020-12-01 07:56:56 -08:00
Carl Bergquist
b7aa6fed1d
Instrumentation: Add examplars for request histograms (#29357)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-12-01 15:04:59 +01:00
Arve Knudsen
f55818ca70
Chore: Enable exhaustive linter (#29458)
* Chore: Enable exhaustive linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-01 09:53:27 +01:00
Arve Knudsen
3c229c6bee
Log: Use os.Open to open file for reading (#29483)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-01 09:28:18 +01:00
Todd Campbell
643f790753
Alerting: Add support for Sensu Go notification channel (#28012)
* Add support for Sensu Go notification channel

Similar to current support for the older "Core" version of
Sensu, this commit add support for the newer version.

Closes #19908

Signed-off-by: Todd Campbell <todd@sensu.io>

* fix linter errors

Signed-off-by: Todd Campbell <todd@sensu.io>

* Apply suggestions from code review

PR review suggestions

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix no new variables error

* Replace convey testing with testify

Signed-off-by: Todd Campbell <todd@sensu.io>

* Wording suggestions

Signed-off-by: Todd Campbell <todd@sensu.io>

* Add docker compose environment for testing/maintenance

Signed-off-by: Todd Campbell <todd@sensu.io>

* Renamed and fixed docker-compose.yaml to work in devenv

Signed-off-by: Todd Campbell <todd@sensu.io>

* Change sensugo web UI port to 3080 so as not to conflict with grafana

Signed-off-by: Todd Campbell <todd@sensu.io>

* Apply suggestions from code review

Set the API key as a secure value.

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>

* Add Sensu Go information to notifications doc

Signed-off-by: Todd Campbell <todd@sensu.io>

* Update pkg/services/alerting/notifiers/sensugo.go

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>

* change assert to require for Error/NoError tests

Signed-off-by: Todd Campbell <todd@sensu.io>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2020-11-27 19:09:24 +02:00
Carl Bergquist
cffc1b13ad
adds tracing for all bus calls that passes ctx (#29434)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-27 14:58:45 +01:00
Arve Knudsen
107f658229
prometheus: Improve IsAPIError's documentation (#29432)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-27 12:05:49 +01:00
Tom Daly
ee3475d900
Elasticsearch: Fix index pattern not working with multiple base sections (#28348)
* Add logic to allow for multiple [] sections in pattern

* Small refactor

* Fix goimport error

* Refactor formateDate
2020-11-27 10:50:35 +01:00
Joan López de la Franca Beltran
c22a39ab2d
Plugins: Add support for includes' icon (#29416)
* Plugins: Add support for includes' icon

* Docs: Add plugin includes' icon reference
2020-11-27 10:48:37 +01:00
Will Browne
d10a8b2761
Alerting: Improve Prometheus Alert Rule error message (#29390)
* provide better ctx for prom err

* rework

* Update pkg/tsdb/prometheus/prometheus.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/prometheus/prometheus.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* call func

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-26 13:38:36 +01:00
Carl Bergquist
bec3fbea47
remove insecure cipher suit as default option (#29378)
G402 (CWE-295):  TLS Bad Cipher Suite  TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-26 12:22:50 +01:00
Carl Bergquist
aebe8985c5
prefer server cipher suites (#29379)
G402 (CWE-295):  TLS PreferServerCipherSuites set false.

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-25 14:56:34 +01:00
taciomcosta
10ff4eecef
Backend: fix IPv6 address parsing erroneous (#28585)
* Backend: Fix parsing of client IP address

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-25 07:55:22 +01:00
Agnès Toulet
22788d1d86
Add an option to hide certain users in the UI (#28942)
* Add an option to hide certain users in the UI

* revert changes for admin users routes

* fix sqlstore function name

* Improve slice management

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* Hidden users: convert slice to map

* filter with user logins instead of IDs

* put HiddenUsers in Cfg struct

* hide hidden users from dashboards/folders permissions list

* Update conf/defaults.ini

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* fix params order

* fix tests

* fix dashboard/folder update with hidden user

* add team tests

* add dashboard and folder permissions tests

* fixes after merge

* fix tests

* API: add test for org users endpoints

* update hidden users management for dashboard / folder permissions

* improve dashboard / folder permissions tests

* fixes after merge

* Guardian: add hidden acl tests

* API: add team members tests

* fix team sql syntax for postgres

* api tests update

* fix linter error

* fix tests errors after merge

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2020-11-24 12:10:32 +01:00
Arve Knudsen
4c47fc56bb
Guardian: Rewrite tests from goconvey (#29292)
* Guardian: Rewrite tests from goconvey

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/services/guardian/guardian_test.go

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-11-24 11:36:00 +01:00
Will Browne
d796c61946
Security: Fixes minor security issue with alert notification webhooks that allowed GET & DELETE requests #29330 2020-11-24 10:42:54 +01:00
Torkel Ödegaard
763e958d9d
Login: Fixes redirect url encoding issues of # %23 being unencoded after login (#29299) 2020-11-24 07:27:08 +01:00
Ryan McKinley
cfaca42e97
InfluxDB: update flux library and support boolean label values (#29310) 2020-11-23 13:19:52 -08:00
Arve Knudsen
063f863abc
WebhookNotifier: Convert tests away from goconvey (#29291)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-23 10:37:53 +01:00
Torkel Ödegaard
1076f47509
Dashboard: Fixes kiosk state after being redirected to login page and back (#29273)
* Login: Fixes issue where url parameters where modified by golang url code

* Add tests

* Fix test cases

* Update pkg/middleware/auth_test.go

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>

* fixed formatting

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2020-11-20 19:30:37 +01:00
Carl Bergquist
702cb90846
make it possible to hide change password link in profile menu (#29246)
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-11-20 17:01:10 +01:00
Arve Knudsen
9593d57914
Chore: Enable errorlint linter (#29227)
* Enable errorlint linter
* Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 14:47:17 +01:00
Arve Knudsen
294770f411
Chore: Handle wrapped errors (#29223)
* Chore: Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 13:34:28 +01:00
Kyle Brandt
0cb29d337a
Expressions: Move GEL into core as expressions (#29072)
* comes from grafana/gel-app
* remove transform plugin code
* move __expr__ and -100 constants to expr pkg
* set OrgID on request plugin context
* use gtime for resample duration
* in resample, rename "rule" to "window", use gtime for duration, parse duration before exec
* remove gel entry from plugins-bundled/external.json
which creates an empty array for plugins
2020-11-19 07:17:00 -05:00
Arve Knudsen
006868339d
Backend: Fix build (#29206)
* Backend: Fix build

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-18 16:16:58 +01:00
Will Browne
2939caf9a2
Permissions: Validate against Team/User permission role update (#29101)
* validate against role field update

* lowercase error string

* make all msgs consistent style

* fix wording

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* sayonara simple json

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-18 15:36:41 +01:00
Carl Bergquist
15a6508d4a
trace user login and datasource name instead of id (#29183)
id's are not very helpful when debugging a system.

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-18 09:21:45 +01:00
Arve Knudsen
8c9bb7a215
playlist: Improve test (#29120)
* playlist: Improve test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-18 09:16:49 +01:00
Karl Atkinson
65ed8a76a6
CloudWatch: added HTTP API Gateway specific metrics and dimensions (#28780) 2020-11-17 19:27:20 +01:00
Alexey Zhiltsov
2212c6dbbb
SQL: Define primary key for tables without it (#22255)
The annotation_tag and alert_rule_tag tables did not have
PRIMARY KEY defined what cause problems with migration to
MariaDB with Galera setup with
 innodb_force_primary_key=1
Or MySQL > 8.0.13 with
 sql_require_primary_key=ON

Which can manifest as follows:

MariaDB
Error 1173: This table type requires a primary key

MySQL
ERROR 3750 (HY000): Unable to create or change a table
without a primary key, when the system variable 'sql_require_primary_key' is set.

Extra reading for curious:
https://jfg-mysql.blogspot.com/2017/08/danger-no-pk-with-RBR-and-mariadb-protection.html

Fixes #12971

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-11-17 17:58:56 +01:00
Arve Knudsen
52c154a221
Backend: Rename variables for style conformance (#29097)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 17:09:14 +01:00
Arve Knudsen
4dd7b7a82d
Chore: Remove unused Go code (#28852)
* Chore: Remove more unused Go code

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:51:31 +01:00
Arve Knudsen
8c765e8068
API: Rewrite tests from goconvey (#29091)
* API: Rewrite tests from goconvey

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix tests

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:31:35 +01:00
Arve Knudsen
2bf964c61e
Chore: Fix linting issues caught by ruleguard (#28799)
* Chore: Fix linting issues caught by ruleguard

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Improve error check

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:27:45 +01:00
Victor Cinaglia
967e9b39e8
Fix panic when using complex dynamic URLs in app plugin routes (#27977)
* remove unused function to interpolate URLs

* share function to add headers between ds/plugin proxies

* stop performing unnecessary plugin setting lookup

* fix bug causing runtime errors when using complex templated URLs

* lower case util functions not used outside of pluginproxy package

* change test URL to a (valid) dummy URL to make intent clearer

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 10:56:42 +01:00
Andrew Mattheisen
4430ca2317
build paths in an os independent way (#29143)
Use filepath instead of path to manipulate filename paths in a way compatible with the target operating system-defined file paths.
2020-11-17 08:03:16 +01:00
Alexander Zobnin
4f9123ebe2
Provisioning: always pin app to the sidebar when enabled (#29084) 2020-11-17 09:45:40 +03:00
Emil Hessman
8c7e7e6d22
Chore: Rewrite preferences test from GoConvey to stdlib and testify (#29129) 2020-11-16 12:54:12 +01:00
Emil Hessman
bdc6e2fe0a
Chore: Require OrgId to be specified in delete playlist command (#29117) 2020-11-14 09:49:07 +01:00
Arve Knudsen
fbf0d2c086
Plugin proxy: Handle URL parsing errors (#29093)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-13 19:38:09 +01:00
Arve Knudsen
e503188b6f
Data source proxy: Convert 401 from data source to 400 (#28962)
* Data source proxy: Convert 401 from data source to 400

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-13 13:21:43 +01:00
Will Browne
eba046d3cb
Auth: Enable more complete credential chain for SigV4 default SDK auth option (#29065)
* Force more complete credential chain for default auth option

* simplify

* allow assume role for default
2020-11-13 10:27:35 +01:00
Arve Knudsen
cb62e69997
Chore: Convert API tests to standard Go lib (#29009)
* Chore: Convert tests to standard Go lib

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-11-13 09:52:38 +01:00
kay delaney
9659c98d61
Test Datasource/Bug: Fixes division by zero in csv metric values scenario (#29029)
Closes #8705
2020-11-12 16:20:08 +00:00
Arve Knudsen
8f9e5a839f
Plugins: Bring back coreplugin package (#29064)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-12 17:16:04 +01:00
Tom Daly
18f3969fdb
Add 'EventBusName' dimension to CloudWatch 'AWS/Events' namespace (#28402) 2020-11-12 16:48:35 +02:00
Marcus Efraimsson
ded4be0435
CloudWatch: Add support for AWS/ClientVPN metrics and dimensions (#29055)
Fixes #28778
2020-11-12 15:47:02 +01:00
Sofia Papagiannaki
43f580c299
AlertingNG: manage and evaluate alert definitions via the API (#28377)
* Alerting NG: prototype v2 (WIP)

* Separate eval package

* Modify eval alert definition endpoint

* Disable migration if ngalert is not enabled

* Remove premature test

* Fix lint issues

* Delete obsolete struct

* Apply suggestions from code review

* Update pkg/services/ngalert/ngalert.go

Co-authored-by: Kyle Brandt <kyle@grafana.com>

* Add API endpoint for listing alert definitions

* Introduce index for alert_definition table

* make ds object for expression to avoid panic

* wrap error

* Update pkg/services/ngalert/eval/eval.go

* Swith to backend.DataQuery

* Export TransformWrapper callback

* Fix lint issues

* Update pkg/services/ngalert/ngalert.go

Co-authored-by: Kyle Brandt <kyle@grafana.com>

* Validate alert definitions before storing them

* Introduce AlertQuery

* Add test

* Add QueryType in AlertQuery

* Accept only float64 (seconds) durations

* Apply suggestions from code review

* Get rid of bus

* Do not export symbols

* Fix failing test

* Fix failure due to service initialization order

Introduce MediumHigh service priority and assign it to backendplugin
service

* Fix test

* Apply suggestions from code review

* Fix renamed reference

Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-11-12 15:11:30 +02:00
Arve Knudsen
a1e80af800
Fix linting issues (#28811)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-12 13:25:14 +01:00
Domas
76df096791
Logging: Log frontend errors (#28073)
* basic frontend  Sentry integration

* backend endpoint to capture sentry events

* WIP!

* log user email for frontend logs

* remove debug logging

* lint fixes

* Fix type exports & property names

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* additional struct naming fix

* rename log endpoint, config section & interface

* add sentry sample rate to config

* refac to use EchoSrv

* log user id

* backend tests

* tests for SentryEchoBackend

* sentry echo backend tests

* CustomEndpointTransport tests

* Update pkg/api/frontend_logging_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update conf/defaults.ini

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/api/frontend_logging_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* don't export unnecesasrily

* update go.sum

* get rid of Convey in tests, use stdlib

* add sentry config to sample.ini

* cleanup to set orig logging handler in test

* Apply suggestions from code review

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* PR feedback changes

* lock sentry version

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-12 12:29:43 +01:00
Emil Hessman
3519330166
Chore: Rewrite test helpers from GoConvey to stdlib (#28919) 2020-11-11 21:33:32 +01:00
Chris Cowan
4ed7612e57
Elasticsearch: Add Moving Function Pipeline Aggregation (#28131)
* Elasticsearch: Add Moving Function Pipeline Aggregation

* Removing support for moving average in 7.x

* Fixing getMetricAggTypes to handle undefined esVersion

* Adding moving_fn to go code

* Update public/app/plugins/datasource/elasticsearch/metric_agg.ts

Co-authored-by: Giordano Ricci <grdnricci@gmail.com>

* Adding test for esversion 70

* Removing default value for script, adding placeholder instead

* Fixing formatting

* Adding code for handling missing or obsolete aggregations

Co-authored-by: Giordano Ricci <grdnricci@gmail.com>
2020-11-11 17:42:28 +00:00
Arve Knudsen
ab078133bf
Backend: Remove unused code (#28933)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-11 11:38:04 +01:00
Carl Bergquist
e3c7d66324
Tracing: Add setting for sampling server (#29011)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-11 10:21:52 +01:00
Arve Knudsen
b5379c5335
Chore: Fix SQL related Go variable naming (#28887)
* Chore: Fix variable naming

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-11 06:21:08 +01:00
kay delaney
b2dcf06b60
Backend: Adds route for well-known change password URL (#28788)
* Backend: Adds route for well-known change password URL

* Include 'dashboard/new' in backend routes

* Move index route handler registration out of "not logged in views" section

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-10 22:36:35 +00:00
Carl Bergquist
db637a3630
Tracing: log traceID in request logger (#28952)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-10 05:45:39 +01:00
Carl Bergquist
afb06ec21a
start tracking usage stats for tempo (#28948)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-09 22:12:23 +01:00