Commit Graph

6504 Commits

Author SHA1 Message Date
Will Browne
057ba4a6e7
fix bad log format (#35150) 2021-06-03 10:26:52 +02:00
Carl Bergquist
ba7aca69f6
plugin: add signature status plugin build info (#35128)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-06-02 20:53:56 +02:00
Kyle Brandt
4093fae99a
SSE: Refactor to simplify Series type (#35063)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-06-02 12:29:19 -04:00
Alexander Emelin
7aee0deb38
live: log error on dashboard subscribe (#35095) 2021-06-02 18:02:54 +03:00
Marcus Efraimsson
d953e200f0
Chore: Refactor short url api test (#35051)
Use a mock of the short URL service rather than real one which requires database access.

Ref #34696
2021-06-01 20:34:59 +02:00
Gábor Farkas
38b030e2a4
InfluxDB: Flux: timestamp-column has to go first (#35036) 2021-06-01 16:03:02 +02:00
Marcus Efraimsson
c775708e45
Chore: Refactor Prometheus custom query parameters middleware (#34814)
Following #34473 refactor to use url.ParseQuery in the Prometheus 
custom query parameter middleware.

Ref #34473
2021-06-01 14:59:44 +02:00
Jan Jansen
0d1b35f99e
Short URL: Fix so that orgId is included in generated short URL (#34696)
Fixes #33813

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-06-01 14:19:10 +02:00
Carl Bergquist
f432fbd793
Instrumentation: add more tracing in the auth context handler. (#34939)
ref https://github.com/grafana/grafana/issues/29489

Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-31 21:39:28 +02:00
Sofia Papagiannaki
51afde34bd
Test datasource: Returns always float values (#34986) 2021-05-31 19:15:46 +03:00
Ganesh Vernekar
a23674ef99
Alerting: Migrate tags as labels and not annotations (#34990)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-31 19:47:17 +05:30
Ganesh Vernekar
7c25465b3a
Alerting: Migrate paused alerts to silences (#34898)
* Alerting: Migrate paused alerts to silences

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-31 17:30:58 +05:30
Will Browne
98c849d4cc
fix permissions + add link for admins (#34906) 2021-05-31 12:30:32 +02:00
Sofia Papagiannaki
355be158b7
[Alerting]: fix/cleanup API examples (#34588) 2021-05-31 11:18:29 +03:00
Ryan McKinley
4972e0f6a1
Rename: Status grid to history (#34864) 2021-05-29 20:24:14 +02:00
Chip Wolf ‮
badec6c6ad
Alerting: Add support for configuring avatar URL for the Discord notifier (#33355)
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-28 23:00:21 +02:00
ying-jeanne
b391e43472
[Dashboard] Revert feature toggle trimdefaults (#34888)
* Revert "solve comments and retrigger the test"

This reverts commit f08d2d9eca.

* Revert "update api doc"

This reverts commit cc09ceb853.

* Revert "remove post trim"

This reverts commit 46fe8ed596.

* Revert "fix typo"

This reverts commit 3b3ceee16e.

* Revert "Apply suggestions from code review"

This reverts commit 3b7f3b8e15.

* Revert "update comments"

This reverts commit b9c6260876.

* Revert "update doc"

This reverts commit 8e4c4d7c93.

* Revert "remove feature toggle + add libraryPaneldefinition"

This reverts commit d01cfcc2ed.

* fix some typos

* Update public/app/features/dashboard/components/ShareModal/ShareExport.tsx

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

* Update docs/sources/dashboards/export-import.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* fix comments

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-28 22:29:30 +02:00
Owen Diehl
cc38613ba4
alerting: fixes per-receiver metric cardinality (#34915) 2021-05-28 12:31:23 -04:00
Owen Diehl
9aca032d10
Alerting/consistent api errors (#34858)
* consolidates alertmanager api errors

* util & testing consistent errors

* consistent errors for rest of ngalert apis

* updates expected errors in testware

* bump ci

* linting

* unrelated: dashboard.go lint
2021-05-28 11:55:03 -04:00
Kyle Brandt
b47e7d12e6
Alerting: Extract values from MD expr alerts (#34757)
When using mulit-dimensional Grafana managed alerts (e.g. SSE math) extract refIds values and labels so they can be shown in the notification and dashboards.
2021-05-28 11:04:20 -04:00
kay delaney
8143991b94
Security: Update default CSP template and fix firefox CSP issues (#34836)
* Security: Update default content_security_policy_template
- Add 'strict-dynamic' back to script-src
- Add ws(s)://$ROOT_PATH to connect-src
- Change onEvent to on-event in angular templates to fix CSP issues in firefox.
- Add blob: to style-src
2021-05-28 17:01:10 +02:00
idafurjes
48f6d6f7e6
Oauth: Assign role from GF_USERS_AUTO_ASSIGN_ORG_ROLE for Azure AD Oauth (#34838)
* 30555:Assign correct role with environment variable GF_USERS_AUTO_ASSIGN_ORG_ROLE

* 30555:Remove unused condition
2021-05-28 16:14:30 +02:00
Ganesh Vernekar
ad6648b649
Alerting: Do no hard fail on finding discontinued channels on migration (#34894)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-28 16:06:30 +02:00
Ganesh Vernekar
8278c7bf77
Alerting: Fix flaky TestNotificationChannels take 2 (#34880)
* Alerting: Fix flaky TestNotificationChannels take 2

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix nits

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-28 15:24:18 +05:30
Alexander Emelin
b73d168753
live: fix log message (#34879) 2021-05-28 11:33:55 +02:00
Danilo Bargen
83a83de10a
Clarify that Threema Gateway Alerts support only Basic IDs (#34828)
Threema Gateway supports two types of IDs: Basic IDs (where the
encryption is managed by the API server) and End-to-End IDs (where the
keys are managed by the user).

This plugin currently does not support End-to-End IDs (since it's much
more complex to implement, because the encryption needs to happen
locally). Add a few clarifications to the UI.

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-28 08:54:55 +02:00
Ganesh Vernekar
89262ac64d
Fix flaky TestNotificationChannels (#34831)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-28 11:03:49 +05:30
Alexander Emelin
6d750c000e
Live: max_connections option with strict default (#34634)
this should help Live to be enabled by default but still
do not affect setups with lots of simultenious users. To
properly handle many WS connections Grafana administrators
should tune infrastructure a bit - for example increase a
number of open files for a process. Will be in more details
in documentation.
2021-05-27 22:03:18 +03:00
Carl Bergquist
a10fa5cad3
Instrumentation: Start tracing database requests (#34572)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-27 13:55:33 +02:00
Domas
347273cdea
Alerting: check upstream response content type in lotex proxy (#34760) 2021-05-27 14:12:29 +03:00
Will Browne
c7b58fe186
Plugins: Enable catalog management link to gcom (#34673)
* click out to gcom when config enabled

* set to false

* fix styling for uninstall

* remove advertising config + simplify callout URL

* add entry to configuration.md

* update config name

* update lingo
2021-05-27 12:45:06 +02:00
Marcus Efraimsson
f76f426da3
Chore: Refactor Prometheus HTTP client middleware (#34473)
Following #33439 this refactors the Prometheus HTTP transport 
which is replaced by HTTP client middleware.
2021-05-27 12:43:21 +02:00
Ryan McKinley
67028af99e
Live: check schema equality between push messages (#34548) 2021-05-27 12:55:42 +03:00
ying-jeanne
c59a2e1bcf
remove feature toggle + add libraryPaneldefinition (#34488)
* remove feature toggle + add libraryPaneldefinition

* update doc

* update comments

* Apply suggestions from code review

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* fix typo

* remove post trim

* update api doc

* solve comments and retrigger the test

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2021-05-27 11:14:58 +02:00
Will Browne
dbef103fb9
check is grafana admin (#34773) 2021-05-27 11:08:16 +02:00
Joan López de la Franca Beltran
f601921670
Usage Stats: Make the UsageStatsService extension point more flexible (#34778)
* Usage Stats: Rename service to use a more idiomatic name

* Usage Stats: Update MetricsFunc definition and implementations

* Revert "Usage Stats: Rename service to use a more idiomatic name"

This reverts commit 910ecce3e8.

* Usage Stats: Update MetricsFunc definition and implementations
2021-05-27 10:53:10 +02:00
Andi Pabst
29be741f26
MySQL Datasource: Add timezone parameter (#27535)
* Add MySQL timezone parameter

* Reword docs/sources/features/datasources/mysql.md

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* update documentation

* fix formatting mistake from merge

* enhance documentation with reason for parameter usage

* enhance documentation with reason for parameter usage

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2021-05-27 10:03:03 +02:00
David Parrott
20d356947c
set state correctly and test (#34680) 2021-05-26 11:37:42 -07:00
Kevin Minehart
3aba08f708
hide caching settings when its disabled (#34756) 2021-05-26 12:27:28 -05:00
Alexander Emelin
4221f2d147
Live: grafana_live namespace for centrifuge prom metrics (#34712) 2021-05-26 10:12:24 -07:00
Ganesh Vernekar
d69c21acb6
NGAlert: Update the default template to include more URLs (#34715)
* NGAlert: Update the default template to include more URLs

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-26 16:49:39 +02:00
Serge Zaitsev
ef0fab9aa5
Expose folder UID in dashboards API response (#33991)
* expose folder UID in dashboards API response, import dashboards into folders by folder UID

* handle bad folder UID as 400 error

* 12591:Add tests for request with folderUid

* Use more descriptive error status for missing folders

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

* return 400 when folder id is missing

* put error checking in the right place this time

* mention folderUid in the docs

* Clarify usage of folderUid and folderId when both present

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

* Capitalise UID

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* mention folder UID in the metadata for a GET response

Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-26 10:20:13 -04:00
Kyle Brandt
9016d20c4c
SSE/Chore: cleanup some error messages (#34738)
removes "rpc error: code = InvalidArgument desc =" like strings from error messages.

This came from old grpc stuff left from when SSE was a plugin (that probably should
not have been used even when it was a plugin)
2021-05-26 15:15:21 +02:00
Torkel Ödegaard
6fb0560a84
TestData: Some simple small test data and first draft of what's new in v8 demo dashboard (#34731)
* TestData: More test data

* Added v8 demo dashboard
2021-05-26 14:11:57 +02:00
Ganesh Vernekar
b168223029
NGAlert: Add integration tests for remaining notification channels (#34662)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-26 16:33:55 +05:30
Serge Zaitsev
dfbf955aa8
simplify method/code sanitization (#34723) 2021-05-26 12:18:54 +02:00
Ben Sully
b7ea66b00d
Datasource: Use intervalMs field of query model in GetIntervalFrom if interval field is not set (#34270)
The /api/ds/query and /api/tsdb/query endpoints extract the intervalMs field from
each query in the request, but it currently seems to be ignored, at
least for queries to a Prometheus datasource. This changes
GetIntervalFrom function to check for the presence of intervalMs in the
query model if interval is missing.
2021-05-26 11:45:11 +02:00
Torkel Ödegaard
987bffe482
TestData: Support for csv files & csv content (#34674)
* initial implementation of csv support for test data source

* CSV file & content scenarios working

* Removing categorical data

* fixing handler names

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Update pkg/tsdb/testdatasource/csv_data.go

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

* Fixed lint issues

* updated so it uses the same parsing

* more CSV tests

* lint fixes

* more lint

* lint

* support time field

* migrate manual entry to csv

* more test output

* more test output

* missing file

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-05-26 10:42:42 +02:00
Arve Knudsen
796590a1aa
Chore: Upgrade opentelemetry.io/collector dependency (#34700)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-26 10:11:37 +02:00
Marcus Andersson
e19b3df1a9
Alerting: added possibility to preview grafana managed alert rules. (#34600)
* starting to add eval logic.

* wip

* first version of test rule.

* reverted file.

* add info colum to result to show error or (with CC evalmatches)

* fix labels in evalmatch

* fix be test

* refactored using observables.

* moved widht/height div to outside panel rendere.

* adding docs api level.

* adding container styles to error div.

* increasing size of preview.

Co-authored-by: kyle <kyle@grafana.com>
2021-05-26 10:06:28 +02:00
Evan Sosenko
80c05becc5
Add missing AWS/AppSync metrics (#34691) 2021-05-26 08:11:26 +02:00
Evan Sosenko
f9b8f3777a
CloudWatch: Add Lambda@Edge Amazon CloudFront metrics (#34561)
* Add LambdaExecutionError to AWS/CloudFront

* Add LambdaValidationError to AWS/CloudFront

* Add LambdaLimitExceededErrors to AWS/CloudFront
2021-05-26 08:11:13 +02:00
Alexander Emelin
063e1b5ff5
Live: use latest changes in Go SDK to deal with streaming frames (#34668) 2021-05-25 10:29:02 -07:00
Owen Diehl
0e0ed43153
Alerting/testing promql extraction (#34665)
* promql compat for marshaling

* extracts upstream instant queries into data frame for alerting

* eval string parity
2021-05-25 11:54:50 -04:00
Sofia Papagiannaki
a5082ab112
Chore: additional check when decrypting values (#34637)
* Chore: additional check when decrypting values

* Apply suggestions from code review
2021-05-25 18:35:54 +03:00
Gábor Farkas
ab26c4dfa4
InfluxDB: Flux: handle boolean data-columns (#34479)
* InfluxDB: Flux: handle boolean data-columns

* normalize data-type strings based on documentation

* reference missing data type
2021-05-25 17:22:04 +02:00
Emil Tullstedt
0f4806db8a
Access control: Rename predefined roles to fixed roles (code) (#34469)
* s/grafana:roles:/fixed:/

* Update free text references to predefined roles
2021-05-25 15:36:01 +02:00
Joan López de la Franca Beltran
b74a502dc4
API: Use SettingsProvider on GET settings handler (#34632) 2021-05-25 15:35:43 +02:00
Erik Sundell
92ac2c40d3
expose azure settings as env variables (#34484) 2021-05-25 13:40:05 +02:00
Dimitris Sotirakis
91657dad18
HTTP Client: Make ResponseHeaderTimeout default timeout in http client (#34597)
* HTTP Client: Add `ResponseHeaderTimeout` - split from `DialContext` timeout

* Fixes according to reviewer's comments

* Use grafana-plugin-sdk-go v0.100.0
2021-05-25 11:32:41 +03:00
Sergey Kostrukov
a337f70469
AzureMonitor: Fix Azure token provider national clouds (#34615)
* Fix AAD authority for sovereign clouds

* Update Azure SDK with scopes fix

* Credential initialization in cache
2021-05-25 08:19:08 +02:00
wangjian
530072fce7
Elasticsearch: fix NewClient not passing httpClientProvider to client impl (#34539)
* Update client.go

fix missing "httpClientProvider" in NewClient

* Update client.go
2021-05-24 14:45:29 +01:00
Sofia Papagiannaki
b48832c0f7
[Alerting]: alertmanager notifier fixes (#34575) 2021-05-24 16:09:29 +03:00
Dimitris Sotirakis
6970c9ebfd
Use laher/mergefs - remove custom code (#34571) 2021-05-24 14:17:40 +02:00
Hugo Häggmark
7b17801047
LibraryPanels: Fixes error when importing plugin dashboard (#34557) 2021-05-24 09:31:34 +02:00
Hugo Häggmark
7204a64717
LibraryElements: Creates usage stats for panels and variables (#34476)
* LibraryPanels: Adds usage collection

* Refactor: renames Panel and Variable consts

* Chore: initialize stats

* Refactor: moves library element migrations to migration namespace
2021-05-24 06:11:01 +02:00
Torkel Ödegaard
d0769397b2
Histogram: Fix crash when state was undefined (when combine was enabled) (#34514) 2021-05-20 17:36:20 +02:00
Giordano Ricci
e2e78f14d2
Elasticsearch: fix flaky test (#34517) 2021-05-20 17:13:48 +02:00
Will Browne
c4dcfdef56
Plugins: Improve plugin installer error messages (#34437)
* fix and improve error messages

* enrich error message

* ignore previous changes

* revert manual version bump

* remove condition

* fix version param
2021-05-20 15:11:07 +02:00
Sofia Papagiannaki
23939eab10
[Alerting]: namespace fixes (#34470)
* [Alerting]: forbid viewers for updating rules if viewers can edit

check for CanSave instead of CanEdit

* Clear ngalert tables when deleting the folder

* Apply suggestions from code review

* Log failure to check save permission

Co-authored-by: gotjosh <josue@grafana.com>
2021-05-20 15:49:33 +03:00
Marcus Efraimsson
60d0c8d0ec
HTTP Client: Outgoing tracing middleware (#34466)
Following #33439 this adds support for outgoing tracing middleware 
in HTTP client provider.

Fixes #24004
2021-05-20 11:16:55 +02:00
Ryan McKinley
a91edd7267
Plugin Admin App: make the catalog look like internal component (#34341)
* Allow Route component usage in app plugins

* i tried

* fix catalog app

* fix catalog app

* fix catalog app

* cleanup imports

* plugin catalog enabled to plugin admin

* rename plugin catalog to plugin admin

* expose catalog url

* update text

* import from react-router-dom

* fix imports -- add logging

* merge changes

* avoid onNavUpdate

* Fixed onNavChange issues

* fix library imports

* more links

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2021-05-20 10:42:26 +02:00
Ganesh Vernekar
95ee5f01b5
NGAlert: Do not pick a random default channel if no default exists (#34465)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-20 10:30:09 +02:00
Josh Hunt
cf94410e59
AzureMonitor: Update Logs workspace() template variable query to return resource URIs (#34445)
* Migrate template variables straight into resource field,

Display error if unable to migrate

* Update workspace() template variable query function to return a resource URI

* update backend to support resource uris in workspace field

* don't load resource names for variables

* throw error when workspace migration returns no results

* update testDatasource to work with either resource URI or workspace GUID

* fix tests

* cleanup types just a little bit, as a treat
2021-05-20 10:16:29 +02:00
gotjosh
7b04278834
Alerting: Opsgenie notification channel (#34418)
* Alerting: Opsgenie notification channel

This translate the opsgenie notification channel from the old alerting
system to the new alerting system with a few changes:

- The tag system has been replaced in favour of annotation.
- TBD
- TBD

Signed-off-by: Josue Abreu <josue@grafana.com>

* Fix template URL

* Bugfig: dont send resolved when autoClose is false

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix integration tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix URLs in all other channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-20 10:12:08 +02:00
Hugo Häggmark
740f1ab3e2
LibraryPanels: Fixes connections after dashboard import (#34461) 2021-05-20 09:40:23 +02:00
Hugo Häggmark
21d6f02dd3
LibraryElements: replaces is_folder=1 usages with correct dialect string (#34453) 2021-05-20 07:22:34 +02:00
Ryan McKinley
b02403e3fc
TestData: use new format for random walk example (#34441) 2021-05-19 21:59:43 -07:00
Marcus Efraimsson
348e76fc8e
Datasource: Shared HTTP client provider for core backend data sources and any data source using the data source proxy (#33439)
Uses new httpclient package from grafana-plugin-sdk-go introduced 
via grafana/grafana-plugin-sdk-go#328. 
Replaces the GetHTTPClient, GetTransport, GetTLSConfig methods defined 
on DataSource model.
Longer-term the goal is to migrate core HTTP backend data sources to use the 
SDK contracts and using httpclient.Provider for creating HTTP clients and such.

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-19 23:53:41 +02:00
David Parrott
7a83d1f9ff
Alerting resend delay for sending to notifiers (#34312)
* adds resend delay to avoid saturating notifier

* correct method signatures

* pr feedback
2021-05-19 22:15:09 +02:00
Owen Diehl
8f350bc353
actually register metrics this time (#34444) 2021-05-19 22:09:12 +02:00
Ganesh Vernekar
e52f718a87
NGAlert: Migrate old notification channel config (#33846)
* NGAlert: Migrate old notification channel config

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Copy the required structs and functions

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix review comments and error on discontinued channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Use both ID and UID to map channels, attach UID to channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Bug fixes

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Use alert table instead of dashboard for channel IDs

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix offline reviews: don't add empty receivers and routes, add receiver for unmigrated channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Handle multiple default channels, pick default from used channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Include default channels in all receivers

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 21:10:12 +02:00
Ganesh Vernekar
533be16787
NGAlert: Add Threema notification channel (#34159)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 20:20:52 +02:00
Ganesh Vernekar
b2e84277a3
NGAlert: Add Kafka notification channel (#34156)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 20:02:09 +02:00
Ganesh Vernekar
ad1d0ae0bf
NGAlert: Add VictorOps notification channel (#34161)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 19:52:14 +02:00
Alexander Emelin
f0ef5e7dcb
Live: channel ID validation (#34215) 2021-05-19 20:47:53 +03:00
Ganesh Vernekar
fb9223ab42
NGAlert: Add Line notification channel (#34157)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 19:04:48 +02:00
Domas
54c33c6cdd
Alerting: update email template (#34205) 2021-05-19 18:58:31 +02:00
Josh Hunt
5dca9fd4d8
AzureMonitor: Support querying any Resource for Logs queries (#33879)
* wip

* wip:

* ui work for resource picker

* disable rows when others are selected

* resource picker open button

* Azure Monitor: Connect to backend with real data (#34024)

* Connect to backend with real data

* Fixes from code review.

* WIP:Begin thinking about how to make queries with scope determined by the resource picker

* More fixes post code review.

* Fixes after rebasing

* Remove outdated todo

* AzureMonitor: Support any resource for Logs queries (#33762)

* Apply button for resource picker

* scroll table body

* secondary cancel button

* loading state for nested rows

* Display resource components in picker button

* fix tests

* fix icons

* move route function

* Migrate from workspace to resource uri for log analytics (#34337)

* reword backwards compat comment

* remove base url suffix

* fix lint error

* move migrations to seperate file

* cleanup

* update regex

* cleanup

* update plugin routes to use new azure auth type

* use AzureDataSourceInstanceSettings alias

Co-authored-by: Sarah Zinger <sarahzinger@users.noreply.github.com>
2021-05-19 17:39:08 +01:00
ying-jeanne
c61dd82163
make featureconfig open (#34395) 2021-05-19 18:24:31 +02:00
Ganesh Vernekar
01e0faf800
NGAlert: Add GoogleChat notification channel (#34153)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 18:24:04 +02:00
David Parrott
a0f175c7a5
also don't allow negative intervalseconds (#34319) 2021-05-19 09:05:32 -07:00
Dominik Prokop
a2cbbe1b8a
BarChart: value label sizing (#34229)
* Bar chart label positioning and sizing

* Dev dashbard

* Improve autosizing

* Remove sync option

* Unify text sizing options between stat-ish visualizations and bar chart

* Add simple categorical data scenario and update dev dashboard

* Remove unused options builder

* Add docs annotations

* Fix go lint
2021-05-19 17:33:56 +02:00
Sergey Kostrukov
e9e80bb4cb
Route fixes for Azure Resource Graph (#34410) 2021-05-19 17:33:03 +02:00
David Parrott
b9f4ec2030
Add discord notifier channel and test (#34150)
* Add discord notifier channel and test

* Correct payload

* remove print statement

* PR feedback and update due to changes in main

* Add discord notifier channel and test

* Correct payload

* remove print statement

* PR feedback and update due to changes in main

* update constructor and tests

* group imports sensibly

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-19 17:31:55 +02:00
Sofia Papagiannaki
a79a4838b8
[Alerting]: Add Pushover integration with the alert manager (#34371)
* [Alerting]: Add Pushover integration with the alert manager

* lint

* Set boundary only for tests

* Remove title field

* fix imports
2021-05-19 16:48:46 +02:00
Owen Diehl
1d2febfa85
[Alerting] Route validations (#34393)
* more routing validation

* go mod

* recursive route validations
2021-05-19 10:36:28 -04:00
Kyle Brandt
e291203528
Alerting: a usage stat for ualerting (#34390)
collects `stats.alert_rules.count` , where alert_rules is the nextgen system
2021-05-19 10:31:25 -04:00
Will Browne
c1ec13035d
Plugins: Enforce signing for all plugins (#34364)
* enforce non-backend plugin signing

* fix tests

* add tests

* add signatures

* apply PR feedback

* update upgrading docs
2021-05-19 15:42:50 +02:00
Kyle Brandt
b987237c9b
Alerting: Remove UALERT_MIG env guard from dashboard rule migration (#34384)
Rules/notifications/etc migration will now be activated with feature flag alone.
When the feature flag is enabled dashboard alerts are migrated into the system.
When the feature flag is removed, all migrated and newly created alerts in the new system are deleted.
2021-05-19 09:37:56 -04:00
Arve Knudsen
9dfaa037d1
Alerting: Migrate Alertmanager notifier (#34304)
* Alerting: Port Alertmanager notifier to v8

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-19 15:27:41 +02:00
Sergey Kostrukov
db1191f3ef
AzureMonitor: Refactor cloud and route resolution in the backend (#34342)
* Determine Azure cloud based on authentication type

* Route resolution for clouds

* Fix tests

* Constants for cloud names

* move arg cloud route logic to routes.go

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
2021-05-19 14:36:16 +02:00
Owen Diehl
d6c4c2fcd5
[Alerting] Ensure upstream validations are run (#34333)
* use embedded validations via noop yaml unmarshaler

* lint

* fixes integration tests now that groupings are handled
2021-05-19 06:22:44 -04:00
Arve Knudsen
aed1c013c0
CSP: Relax default template wrt. loading of scripts, due to nonces not working (#34363)
* CSP: Relax default template, due to nonces not working

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

* CSP: Add back data: to img-src

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-19 11:37:14 +02:00
shuotli
71fd0981ca
AzureMonitor: Add Azure Resource Graph (#33293)
* Add Azure Resource Graph in Azure Plugin

* fix lodash import

* Fix mock queries

* use "backend" sdk

* Address comments

* add converter for object type

* Query error should cause 400 & apply template var

* fix backend test & add documentation

* update image

* Address comments

* marshal body from map

* use interpolated query instead of raw query

* fix test

* filter out empty queries

* fix go linting problem

* use new query field language name

* improve variable tests

* add better tests for interpolate variable

Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
2021-05-19 10:31:27 +02:00
Will Browne
4e31169a43
Plugins: Catalog force enable via config and remove enterprise plugin options (#34358)
* force enable catalog based on backend config

* update comments

* chore(plugin-catalog): remove config page in favour of backend flag

* docs(plugin-catalog): update readme

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2021-05-19 10:22:31 +02:00
Freshleaf Media
c30f6fe8fe
Cloudwatch: Adds StorageBytes metrics. Fixes #31836 (#33426) 2021-05-19 09:40:44 +02:00
idafurjes
1e8e7e34f1
Plugins: Remove support for deprecated backend plugin protocol version (#34127)
* 33959: Remove support for deprecated backend plugin protocol (v1)

* 33959: Remove unused methods

* 33959: Remove some additional unused code

* 33959: Remove some additional unused code

* 33959: Remove datasource plugin wrapper with test

* 33959:Remove DefaultProtocolVersion
2021-05-19 08:57:48 +02:00
Erik Sundell
5042dc3b52
CloudMonitoring: Add support for preprocessing (#33011)
* add support for handling preprocessors in the backend

* add preprocessor tests

* use uppercase for constants

* add super label component

* remove error message from query editor since its not working (probably cause onDataError doesnt work anymore)

* use cheat sheet instead of help

* add return type annotation for projects

* add support for preprocessing. replace segment comp with select. change components names and refactoring

* cleanup

* more pr feedback

* fix annotations editor

* rename aggregation component

* fix broken test

* remove unnecessary cast

* fix strict errors

* fix more strict errors

* remove not used prop

* update docs

* use same inline label for annotation editor

* fix react prop warning

* disable preprocessing for distribution types

* using new default values for reducer

* auto select 'rate' if metric kind is not gauge

* fix create label format

* pr feedback

* more pr feedback

* update images
2021-05-19 08:16:05 +02:00
Owen Diehl
c48c701791
adds missing metric name (#34307) 2021-05-18 17:24:38 -04:00
Alexander Emelin
e799257637
Live: stream resubmit on ds change, fix old ds settings in RunStream (#34130) 2021-05-18 21:39:56 +03:00
David Parrott
25485100b0
Alerting: Trim results when at processing instead of on ticker (#34248)
* Trim results when at processing instead of on ticker

* User RWMutex correctly

* remove comment
2021-05-18 10:56:14 -07:00
David Parrott
bbb7bbf891
Alerting: Remove back end logic for supporting KeepLastState (#34242)
* Removed back end logic for supporting KeepLastState

* Map keep_state correctly in migrations
2021-05-18 10:55:43 -07:00
Carl Bergquist
4710566514
bus: add ctx for all signed in user queries (#33970)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-18 18:24:42 +02:00
Sofia Papagiannaki
ff112f07e3
[Alerting]: Add Sensu Go integration with the alert manager (#34045)
* [Alerting]: Add sensugo notification channel

* Apply suggestions from code review

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

* Do not include labels with concatenated rule UID and names

* Modifications after syncing with main

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
2021-05-18 17:31:51 +03:00
Sofia Papagiannaki
11243dec14
[Alerting]: Assign UUID to grafana receivers (#34241)
* [Alerting]: Assign UUID to grafana receivers

* Apply suggestions from code review

* Add test for updating invalid receiver

Co-authored-by: Domas <domasx2@gmail.com>
2021-05-18 17:31:00 +03:00
Sergey Kostrukov
c1b8a10f41
Plugins: Fix Azure token provider cache panic and auth param nil value (#34252)
* More tests for token cache

* Safeguarding from panic and concurrency fixes

* Update Azure dependencies

* Fix interpolation of empty plugin data
2021-05-18 15:36:58 +02:00
Kyle Brandt
63b2dd06a5
Alerting: Set "value" with evalmatches in G Managed (#34075)
When, and currently only when using a classic condition, evaluation information is added (which is like the EvalMatches from dashboard alerting).

This is returned via the API and can be included in notifications by reading the `__value__` label attached `.Alerts` in the template. It is a string.
2021-05-18 09:12:39 -04:00
Hugo Häggmark
592a3af40e
LibraryPanels: Fixes "error while loading library panels" (#34278)
* LibraryPanels: Fixes error while loading library panels

* Chore: fixes imports
2021-05-18 14:52:19 +02:00
Arve Knudsen
d1a9044171
CSP: Allow all image sources by default (#34265)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-18 13:41:55 +02:00
Ganesh Vernekar
89c2b5e863
NGAlert: Remove unwanted fields from notification channel config (#34036)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-18 10:04:47 +02:00
Dimitris Sotirakis
bfcf82f861
Scuemata: Add grafana-cli command to validate resources against scuemata (#33852)
* Add validate-resource cli command

* Fixes according to reviewer's comments
2021-05-18 10:30:13 +03:00
Gábor Farkas
bd4afe41ba
Tempo: fix handling of trace-not-found cases (#34219) 2021-05-18 08:33:53 +02:00
Dimitris Sotirakis
b9eab37149
Scuemata: Add MergeFS implementation to enable iteration for multiple filesystems (#33989)
* Add MergeFS implementation to enable iteration to multiple filesystems

* Fix linting

* Fix misplaced close file

* Move mergefs functionality into tests

* Fix linting

* Add mergefs test

* Dummy commit - remove

* Test fixes - renaming

* Fix ReadDir

# Keeps first filesystem's overridden file

* Fixes according to reviewer's comments

* Remove dummy test

* Remove walkdir

* Small test refactoring
2021-05-18 09:22:31 +03:00
Ryan McKinley
de5cd4a7d3
Timeline: split "periodic" mode into its own panel (#34171) 2021-05-17 13:00:04 -07:00
gotjosh
6384f86fb9
Alerting: Allow the notifier to log (#34232)
* Alerting: Allow the notifier to log

The notifier upstream code uses go-kit as its logging library. The
grafana specific logger is not compatible with this API. In this PR, I
have created a wrapper that implements io.Writer to make them
compatible.
2021-05-17 18:06:47 +01:00
Kyle Brandt
331991ca10
UAlerting: Increase default max datapoints (#34223)
Change const value from 100 to 43200 (12 hours at 1sec interval)
2021-05-17 18:46:52 +02:00
Ryan McKinley
edcefe1c8e
Chore: Rename "marketplace" app to "catalog" (#34149) 2021-05-17 08:27:56 -07:00
Vardan Torosyan
1e566e7783
Access control: Add phone-home metrics to check if fine-grained access control is enabled or not (#34107)
* Access control: Add phone-home metrics to check if fine-grained access control is enabled or not

* Apply suggestions from code review
2021-05-17 16:33:38 +02:00
Sofia Papagiannaki
3e48fe9475
[Alerting]: Fix integration test (#34204) 2021-05-17 14:27:39 +02:00
donomii
fc451cf277
Access Control: Add histograms for evaluator and permissions checks (#34026)
This patch adds metrics to support instrumenting the accesscontrols package.
It also instruments the accesscontrol evaluator and the permissions function.

Co-authored-by: Vardan Torosyan <vardants@gmail.com>
2021-05-17 13:52:16 +02:00
Ganesh Vernekar
d5ae55c5dd
NGAlert: Add message field to email notification channel (#34044)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-17 16:05:09 +05:30
Domas
7a2dff741b
Alerting: Global config form for cloud alert manager (#34074) 2021-05-17 10:50:29 +02:00
Domas
8a0dbd0127
Alerting: enforce roles on frontend (#33997) 2021-05-17 11:15:17 +03:00
Matthew Coltman
bc21adf712
CloudWatch: Allow use of missing AWS namespaces using custom metrics (#30961)
* add tests

* CloudWatch: Allow use of missing AWS namespaces using custom metrics

* CloudWatch: Allow use of missing AWS namespaces using custom metrics
2021-05-17 07:32:32 +02:00
Owen Diehl
1367f7171e
Alerting/ruler metrics (#34144)
* adds active configurations metric

* rule evaluation metrics

* ruler metrics

* pr feedback
2021-05-14 16:13:44 -04:00
gotjosh
eb74994b8b
Alerting: Modify configuration apply and save semantics - v2 (#34143)
* Save default configuration to the database and copy over secure settings
2021-05-14 19:49:54 +01:00
kay delaney
c778d6a4a2
Library Panels: Add name endpoint & unique name validation to AddLibraryPanelModal (#33987) 2021-05-14 15:03:37 +01:00
Sergey Kostrukov
81f6c806e1
Azure token provider with support for Managed Identities (#33807)
* Azure token provider

* Configuration for Azure token provider

* Authentication via Azure SDK for Go

* Fix typo

* ConcurrentTokenCache for Azure credentials

* Resolve AAD authority for selected Azure cloud

* Fixes

* Generic AccessToken and fixes

* Tests and wordings

* Tests for getAccessToken

* Tests for getClientSecretCredential

* Tests for token cache
2021-05-14 13:59:07 +02:00
Carl Bergquist
8254efc027
metrics: instrument request with histograms by default (#33921)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-14 12:53:50 +02:00
Giordano Ricci
8ec87250c1
Elasticsearch: Fix handling of inline scripts in different ES versions (#34070)
* Devenv: add block for es 5.0, provisioned datasource & dashboard

* Trasnsform script property based on running ES version

* Handle different scripts format in BE
2021-05-14 11:50:15 +01:00
Dimitris Sotirakis
2b1e6c136f
Scuemata: Add error wrapper for CUE sanity errors (#33934)
* Add error wrapper for CUE sanity errors

* Fix error

* Fix linting

* Update test

* Update TestCueErrorWrapper assertions
2021-05-14 09:02:41 +02:00
wengelbrecht-grafana
2fc9c6ca58
Fix key and deleteKey being ignored when creating a snapshot with external=true set (#33686)
* Update dashboard_snapshot.go

This is to address: https://github.com/grafana/grafana/issues/33665

The key and deleteKey fields are not honoured when creating a snapshot with external:true set

* removed whitespace
2021-05-13 15:39:43 -07:00
Owen Diehl
fc90c36d50
removes unused db method (#34082) 2021-05-13 20:28:10 +02:00
Owen Diehl
baca873a84
extracts alertmanager from DI, including migrations (#34071)
* extracts alertmanager from DI, including migrations

* includes alertmanager Run method in ngalert

* removes 3s test shutdown timeout

* lint
2021-05-13 14:01:38 -04:00
Ganesh Vernekar
ec3214bac2
NGAlert: Add integration tests for notification channels (#33431)
* NGAlert: Add integration tests for notification channels

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix the failing tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix review comments

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Override creation of rule UID, remove only namespace UID

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-13 22:58:19 +05:30
Kyle Brandt
babb17afd6
Alerting/Chore: Move tests from tests package (#34059)
Instead put in package folder but with package name suffixed with _test
This enables code coverage within the pkg while still allow the tests to operate from external to package perspective (only exported things).
2021-05-13 10:05:33 -04:00
Ganesh Vernekar
5f44ccff0c
NGAlert: Fix unit test to write files in temporary directory (#34032)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-13 16:08:12 +05:30
Alexander Emelin
e97750b824
Live: labels column as default frame format (#33984)
* labels columns as default frame format

* update sdk

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-05-13 11:01:20 +02:00
Conor Evans
83abaa8bdf
Quota: Do not count folders towards dashboard quota (#32519)
For dashboard quota fix so that folders are not counted as dashboards.

Fixes #31317

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-05-12 23:44:46 +02:00
Emil Tullstedt
c2e761f28e
Access control: Attach ID to error message (#33472) 2021-05-12 23:00:27 +02:00
Alexander Emelin
a14ae53347
UseRunStream is a default behaviour (#34021) 2021-05-12 22:17:31 +03:00
Jack Westbrook
abdceb18da
Plugins: introduce marketplace app (#33869)
* add uninstall flow

* add install flow

* small cleanup

* smaller-footprint solution

* cleanup + make bp start auto

* fix interface contract

* improve naming

* accept version arg

* ensure use of shared logger

* make installer a field

* add plugin decommissioning

* add basic error checking

* fix api docs

* making initialization idempotent

* add mutex

* fix comment

* fix test

* add test for decommission

* improve existing test

* add more test coverage

* more tests

* change test func to use read lock

* refactoring + adding test asserts

* improve purging old install flow

* improve dupe checking

* change log name

* skip over dupe scanned

* make test assertion more flexible

* remove trailing line

* fix pointer receiver name

* update comment

* add context to API

* add config flag

* add base http api test + fix update functionality

* simplify existing check

* clean up test

* refactor tests based on feedback

* add single quotes to errs

* use gcmp in tests + fix logo issue

* make plugin list testing more flexible

* address feedback

* fix API test

* fix linter

* undo preallocate

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* fix linting issue in test

* add docs placeholder

* update install notes

* Update docs/sources/plugins/marketplace.md

Co-authored-by: Marcus Olsson <marcus.olsson@hey.com>

* update access wording

* add more placeholder docs

* add link to more info

* PR feedback - improved errors, refactor, lock fix

* improve err details

* propagate plugin version errors

* don't autostart renderer

* add H1

* fix imports

* feat(bundled-plugins): introduce marketplace-app to the repo

* chore(marketplace-app): remove backend

* feat(marketplace): nav is only visible to admins

* feat(marketplace): use gnet api

* refactor(marketplace): move styles to theme2 move card concerns to card component

* feat(marketplace): introduce loaders, clean up styles

* refactor(marketplace): wip - debugging for api endpoints

* feat(grafana-ui): introduce height prop to Layout components

* refactor(marketplace): clean up org details component

* fix(marketplace): display search results without active filters

* refactor(marketplace): use grafana api for install/uninstall

* refactor(marketplace): remove pluginDir

* feat(marketplace): clean up Library page

* fix(plugins): get panel plugins from meta for newly installed plugins

* fix(marketplace): fix multiple renders of InstallControls when installing/uninstalling plugins

* refactor(marketplace): componentise the loader

* chore(marketplace): remove unsigned plugins option

* refactor(marketplace): remove includeUnsigned from codebase

* refactor(marketplace): prefer useStyles over useTheme

* docs(marketplace): remove changelog and update readme

* Apply suggestions from code review

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

* refactor(marketplace): prefer module over class for api

* refactor(marketplace): move updatePlugin to api

* refactor(marketplace): add PluginMeta to api to please TS

* feat(marketplace): always include pre-release in semver check

* chore(marketplace): remove redundant arch install code. backend handles it now

* feat(marketplace): add a link to browse page if library is empty

* refactor(marketplace): replace status with isLoading boolean for hooks

* refactor(marketplace): clean up async functions in InstallControls

* fix(marketplace): setInstalled false on successful uninstall

* include marketplace in bundled plugin test

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Marcus Olsson <marcus.olsson@hey.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2021-05-12 21:07:37 +02:00
Kyle Brandt
3da8db7f3f
Alerting: Run table migrations regardless of feature flag and move out of service (#33996) 2021-05-12 14:39:48 -04:00
Will Browne
c39d6ad97d
Plugins: Enable plugin runtime install/uninstall capabilities (#33836)
* add uninstall flow

* add install flow

* small cleanup

* smaller-footprint solution

* cleanup + make bp start auto

* fix interface contract

* improve naming

* accept version arg

* ensure use of shared logger

* make installer a field

* add plugin decommissioning

* add basic error checking

* fix api docs

* making initialization idempotent

* add mutex

* fix comment

* fix test

* add test for decommission

* improve existing test

* add more test coverage

* more tests

* change test func to use read lock

* refactoring + adding test asserts

* improve purging old install flow

* improve dupe checking

* change log name

* skip over dupe scanned

* make test assertion more flexible

* remove trailing line

* fix pointer receiver name

* update comment

* add context to API

* add config flag

* add base http api test + fix update functionality

* simplify existing check

* clean up test

* refactor tests based on feedback

* add single quotes to errs

* use gcmp in tests + fix logo issue

* make plugin list testing more flexible

* address feedback

* fix API test

* fix linter

* undo preallocate

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* fix linting issue in test

* add docs placeholder

* update install notes

* Update docs/sources/plugins/marketplace.md

Co-authored-by: Marcus Olsson <marcus.olsson@hey.com>

* update access wording

* add more placeholder docs

* add link to more info

* PR feedback - improved errors, refactor, lock fix

* improve err details

* propagate plugin version errors

* don't autostart renderer

* add H1

* fix imports

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Marcus Olsson <marcus.olsson@hey.com>
2021-05-12 20:05:16 +02:00
Andrej Ocenas
293677a0cb
Prometheus: Add custom query params for alert and exemplars queries (#32440)
* Add configuration for custom query params

* Add custom transport in prometheus

* Move custom query handling to request method

* Add encoding
2021-05-12 19:30:41 +02:00
Alexander Emelin
2459a0ceb5
live: remove demultiplexor (#34012) 2021-05-12 18:47:03 +03:00
Alexander Emelin
765fa675f5
live: disable gzip for ws endpoints (#34015) 2021-05-12 18:39:57 +03:00
Agnès Toulet
ec71919e7b
Rendering: add CSV support (#33729)
* Rendering: add CSV rendering support

* Rendering: save csv files into a separate folder

* add missing field

* Renderer: get filename from renderer plugin

* apply PR suggestions

* Rendering: remove old PhantomJS error

* Rendering: separate RenderCSV and Render functions

* fix alerting test

* Rendering: fix handling error in HTTP mode

* apply PR feedback

* Update pkg/services/rendering/http_mode.go

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>

* apply PR feedback

* Update rendering metrics with type label

* Rendering: return error if not able to parse header

* Rendering: update grpc generated file

* Rendering: use context.WithTimeout to render CSV too

Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
2021-05-12 17:16:57 +02:00
Sergey Kostrukov
81ad9769fa
AzureMonitor: Azure settings in Grafana server config (#33728)
* Azure cloud settings

* Fix typos

* Grouped Azure settings

* Doc fixes

* Some settings are not needed

* Updated cloud name aliases
2021-05-12 16:23:37 +02:00
idafurjes
f2fcf721eb
32540: Add org users with pagination (#33788)
* Add model for search org user and add handler for dispatch

* 32540_org_users_with_pagination: Add endpoint for search org users

* 32540_org_users_with_pagination: Add test for org user search handler

* 32540_org_users_with_pagination: fix indentation

* 32540_org_users_with_pagination: Remove newline

* 32540_org_users_with_pagination: Remove empty line

* 32540_org_users_with_pagination: Fix indentation

* Update pkg/api/org_users.go

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

* Update pkg/api/org_users.go

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

* Update pkg/models/org_user.go

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

* Update pkg/api/org_users_test.go

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

* Update pkg/api/org_users_test.go

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

* 32540_org_users_with_pagination: Use hs.SQLStore.SearchOrgUsers instead of bus

* Add model for search org user and add handler for dispatch

* 32540_org_users_with_pagination: Add endpoint for search org users

* 32540_org_users_with_pagination: Add test for org user search handler

* 32540_org_users_with_pagination: fix indentation

* 32540_org_users_with_pagination: Remove newline

* 32540_org_users_with_pagination: Remove empty line

* 32540_org_users_with_pagination: Fix indentation

* Update pkg/api/org_users.go

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

* Update pkg/api/org_users.go

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

* Update pkg/models/org_user.go

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

* Update pkg/api/org_users_test.go

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

* Update pkg/api/org_users_test.go

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

* 32540_org_users_with_pagination: Use hs.SQLStore.SearchOrgUsers instead of bus

* 32540_org_users_with_pagination: Add test for the sqlstore

* 32540_org_users_with_pagination: Fix sqlstore test

* Update pkg/api/org_users.go

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

* Update pkg/api/org_users_test.go

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

* Update pkg/api/org_users_test.go

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

* Update pkg/services/sqlstore/org_users.go

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

* Update pkg/services/sqlstore/org_users.go

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

* Update pkg/services/sqlstore/org_test.go

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

* Update pkg/services/sqlstore/org_test.go

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

* 32540: Fix search org users method

* 32540: Fix sqlstore test

* 32540: Fix go-lint

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-12 14:10:35 +02:00
Owen Diehl
3b06f52bab
Alerting/allow empty receiver (#33962)
* simplifies yaml unmarshaling: PostableApiReceiver

* allow empty receiver type

* allows name only receivers (blackhole)

* better receiver type parsing

* linting
2021-05-12 07:58:16 -04:00
Kyle Brandt
a735c51202
Alerting/Chore: Backend remove def_ columns from instance (#33875)
rename def_uid and def_org_id to rule_uid and rule_org_id on the alert_instance table and drops the definition table.
2021-05-12 07:17:43 -04:00
Ganesh Vernekar
8d442c9b44
NGAlert: Fix templating and remove unwanted default templates (#33918)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-05-12 15:13:43 +05:30
Ivana Huckova
6c532c3f1e
Loki: Use data source settings for alerting queries (#33942)
* Add Tripperware

* Return TLSConfig

* Create transport outside of client
2021-05-12 11:20:16 +02:00
afayngelerindbx
b0094b325e
Annotations: Prevent orphaned annotation tags cleanup when no annotations were cleaned (#33957)
Fixes #33948

Co-authored-by: Anatoly Fayngelerin <afayngelerin@dropbox.com>
2021-05-12 10:44:00 +02:00
ying-jeanne
a7ea0ca849
refactory to move trim/apply default into schema.go (#33754)
* refactory to move trim/apply default into schema.go

* fix comments

* move schema test outside of load folder
2021-05-12 15:38:00 +08:00
Hugo Häggmark
69d9f427e1
LibraryPanels: removes feature toggle (#33839)
* WIP: intial structure

* Refactor: adds create library element endpoint

* Feature: adds delete library element

* wip

* Refactor: adds get api

* Refactor: adds get all api

* Refactor: adds patch api

* Refactor: changes to library_element_connection

* Refactor: add get connections api

* wip: in the middle of refactor

* wip

* Refactor: consolidating both api:s

* Refactor: points front end to library elements api

* Tests: Fixes broken test

* LibraryPanels: removes feature toggle

* Fix: fixes delete library elements in folder and adds tests

* Tests: fixes snapshot

* Refactor: adds service interfaces so they can be easily mocked

* Refactor: changes order of tabs in manage folder

* Refactor: fixes so link does not cover whole card

* Refactor: fixes index string name

* Update pkg/services/libraryelements/libraryelements.go

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

* Update pkg/services/libraryelements/libraryelements_permissions_test.go

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

* Update pkg/services/libraryelements/database.go

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

* Chore: changes after PR comments

* Update libraryelements.go

* Update libraryelements.go

* Chore: updates after PR comments

* Chore: trying to fix build error

* Refactor: fixed stupid mistake

* Update libraryelements.go

* Chore: tries to fix build errors

* Refactor: trying to fix MySQL key length

* Update libraryelements.go

* Update pkg/services/libraryelements/libraryelements.go

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

* Update pkg/services/librarypanels/librarypanels.go

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

* Refactor: changes after PR comments

* Refactor: changes after PR comments

* Tests: fixes tests

* Refactor: renames connections to connectedDashboards

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-12 08:48:17 +02:00
sam boyer
8fe7da5183
Models: Properly indicate Apache licensing of CUE files (#33960) 2021-05-11 21:44:57 -07:00
Alexander Emelin
95a356a840
Live: using organisation IDs throughout stack (#33714) 2021-05-11 22:03:04 +03:00
Alexander Zobnin
a015bb3a23
Access Control: Fix side menu links (#33945) 2021-05-11 21:10:07 +03:00
Emil Tullstedt
68cdbb611f
Access control: Use global scope for users permissions (#33941)
Quick fix. We eventually will want to make users endpoints more aware of
the access control system.
2021-05-11 20:04:29 +02:00
Marcus Efraimsson
6c728d6a78
SQL: Use SDK sqlutil package refactor (#33758)
Upgrades grafana-plugin-sdk-go dependency to v0.94.0 to get 
the refactored sqlutil package. 

Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
2021-05-11 14:59:33 +02:00
Carl Bergquist
b6e6fa53fc
instrumentation: prefix metrics with grafana (#33925)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-11 14:37:03 +02:00
Dimitris Sotirakis
ff262ed3fb
Scuemata: Simplify grafana-cli cue validation tests (#33913)
* Simplify tests

* Make PanelFieldConfig optional in missing panel scenario
2021-05-11 15:11:17 +03:00
Kyle Brandt
dc3e17ba5b
Alerting: Change rule migration to be based on feature flag (#33792)
makes it so the feature flag can be turned on off, and the migration will be cleared and rerun. All existing NG alert rules, configuration settings, etc are removed when disabling the feature flag.
for https://github.com/grafana/alerting-squad/issues/142

Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
2021-05-11 08:08:39 -04:00
Gábor Farkas
2633f245ba
InfluxDB: Flux: Improve handling of complex response-structures (#33823) 2021-05-11 12:36:04 +02:00
Giordano Ricci
e98a8bd11b
Elasticsearch: use semver strings to identify ES version (#33646)
* Elasticsearch: use proper semver strings to identify ES version

* Update BE & tests

* refactor BE tests

* refactor isValidOption check

* update test

* Update pkg/tsdb/elasticsearch/client/client.go

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* Update pkg/tsdb/elasticsearch/client/search_request_test.go

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>

* Remove leftover FIXME comment

* Add new test cases for new version format

* Docs: add documentation about version dropdown

* Update docs/sources/datasources/elasticsearch.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/elasticsearch.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/elasticsearch.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update provisioning documentation

Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-11 09:44:00 +01:00
Sofia Papagiannaki
f4750fb3c8
[Alerting]: Alertmanager API apply permissions (#33843)
* [Alerting]: Alertmanager API apply permissions

* Apply suggestions from code review
2021-05-11 11:31:38 +03:00
Ryan McKinley
a469fa8416
TestData: allow true and false strings as bool (#33889) 2021-05-10 22:29:46 -07:00
Hugo Häggmark
f1b2c750e5
LibraryElements: Adds library elements api and tables (#33741)
* WIP: intial structure

* Refactor: adds create library element endpoint

* Feature: adds delete library element

* wip

* Refactor: adds get api

* Refactor: adds get all api

* Refactor: adds patch api

* Refactor: changes to library_element_connection

* Refactor: add get connections api

* wip: in the middle of refactor

* wip

* Refactor: consolidating both api:s

* Refactor: points front end to library elements api

* Tests: Fixes broken test

* Fix: fixes delete library elements in folder and adds tests

* Refactor: changes order of tabs in manage folder

* Refactor: fixes so link does not cover whole card

* Update pkg/services/libraryelements/libraryelements.go

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

* Update pkg/services/libraryelements/libraryelements_permissions_test.go

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

* Update pkg/services/libraryelements/database.go

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

* Chore: changes after PR comments

* Update libraryelements.go

* Chore: updates after PR comments

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-11 07:10:19 +02:00
Owen Diehl
e18ca8f6f2
enforce receivers align with backend type when posting AM config (#33877) 2021-05-10 16:58:41 -04:00
jvoeller
0d044285a9
OAuth: Add support for empty scopes (#32129)
* add parameter empty_scopes to override scope parameter with empty value and thus be able to authenticate against IdPs without scopes. Issue #27503

Update docs/sources/auth/generic-oauth.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* updated check according to feedback

* Update generic-oauth.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-10 13:07:30 -04:00
Alexander Emelin
c610eff5cd
live: move connection endpoint to api scope, fixes #33861 (#33863) 2021-05-10 19:56:02 +03:00
Serge Zaitsev
7367cfc0a3
Add isolation level db configuration parameter (#33830)
* add isolation level db configuration parameter

* add isolation_level to default.ini and sample.ini

* add note that only mysql supports isolation levels for now

* mention isolation_level in the documentation

* Update docs/sources/administration/configuration.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-05-10 17:54:13 +02:00
Serge Zaitsev
da13f88862
Redact sensitive values before logging them (#33829)
* use a common way to redact sensitive values before logging them

* fix panic on missing testCase.err, simplify require checks

* fix a silly typo

* combine readConfig and buildConnectionString methods, as they are closely related
2021-05-10 17:03:10 +02:00
Will Browne
5c13820bba
Ensure http client has no timeout (#33856) 2021-05-10 16:59:33 +02:00
Kyle Brandt
8feeaab996
Alerting: Disable dash alerting if NG enabled (#33794) 2021-05-10 10:46:01 -04:00
ying-jeanne
0b97cdcee1
fix postgres to have precision of ms (#33853) 2021-05-10 22:22:13 +08:00
Sofia Papagiannaki
1c58fd380f
[Alerting]: store encrypted receiver secure settings (#33832)
* [Alerting]: Store secure settings encrypted

* Move encryption to the API handler
2021-05-10 15:30:42 +03:00
Rodrigo Fior Kuntzer
4fc1810cb7
CloudWatch: added Amplify Console specific metrics and dimensions (#33171) 2021-05-10 13:55:48 +02:00
Vardan Torosyan
1d15686bdf
Access control: Add a role for provisioning admins (#33787) 2021-05-10 11:46:42 +02:00
Will Browne
9726c76429
Chore: Swap out use of backend plugin SDK's backend.Logger (#33783)
* Remove use of backend SDKs backend.Logger

* reorder imports

* FIx logger name

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

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-05-07 15:16:21 +02:00
Sergey Kostrukov
1790737cf1
Plugins: AuthType in route configuration and params interpolation (#33674)
* AuthType in route configuration

* Pass interpolated auth parameters to token provider

* Unit tests

* Update after review

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

Fixes #33669
Closed #33732
2021-05-06 22:05:23 +02:00
Alexander Emelin
bfd5d3b16a
Live: streamId in path for ws push endpoint (#33786) 2021-05-06 12:28:14 -07:00
David Parrott
e58aca2d20
Alerting: remove instances from db and cache on rule update (#33722)
* remove instances from db and cache on rule update

* fix panic

* rename
2021-05-06 18:39:34 +02:00
Dimitris Sotirakis
47af158ddb
Scuemata: Add grafana-cli command to validate basic scuemata (#33523)
* Add grafana-cli command to validate basic scuemata

* Fix c/p outdated message

* Fix linting - naming

* Add basic testing

* Add cue schema validation

* Add tests

* Fix linting errors

* Remove code - refactored tests

* Remove unnecessary files - leftovers

* Fix linting

* Try adding public folder in testdata
2021-05-06 18:21:08 +02:00
Alexander Emelin
03e91eb1a6
updated sdk-go to v0.93.0, adapt tests (#33769) 2021-05-06 18:10:51 +03:00
Arve Knudsen
c2c1ec7d0f
Chore: Move from master to main branch (#33693)
* Chore: Move from master branch to main

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

* CI: Upgrade build pipeline tool to v2

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-06 16:29:29 +02:00
Kyle Brandt
fae093bbe2
Alerting: Fix state cache getOrCreate panic (#33777) 2021-05-06 14:35:52 +02:00