Commit Graph

5373 Commits

Author SHA1 Message Date
Omar Nahhas Sanchez
cf23f15a08
Adding debug line to search ldap. (#23824) 2020-04-24 09:53:42 +02:00
Andrej Ocenas
376765b3d7
Tracing: Remove feature flag (#23834) 2020-04-23 20:46:42 +02:00
Kyle Brandt
80e1191ca0
Backend Plugins: (breaking change) Add PluginContext (#23788)
* breaking change for newer backend plugins
* use exported protobuf converters and sdk types to reduce duplicate code
* uses grafana-plugin-sdk-go@v0.54.0
2020-04-23 14:08:21 -04:00
Leonard Gram
ebdbb0c96d
Rendering: makes sure IsAvailable can be used during init of other services (#23817)
* Rendering: makes sure service knows if it is configured after Init()

* Rendering: refactor
2020-04-23 14:44:52 +02:00
Arve Knudsen
7d88018531
DataSourceProxy: Handle URL parsing error (#23731)
* pluginproxy: Handle URL parsing error
* pkg/api: Validate data source URLs
* pkg/api: Return 400 for URL validation error
2020-04-22 10:30:06 +02:00
Marcus Efraimsson
61de19250d
Image Rendering: Make it work using serve_from_sub_path configured (#23706)
Make rendering work when using serve_from_sub_path and not have rendering.renderer_url configured.

Fixes #21925
2020-04-21 19:57:11 +02:00
Marcus Efraimsson
871ad73414
Backend plugins: Renderer v2 plugin (#23625)
grafana-plugin-model is legacy and is replaced by new backend 
plugins SDK and architecture. Renderer is not part of SDK and 
we want to keep it that way for now since it's highly unlikely there 
will be more than one kind of renderer plugin.
So this PR adds support for renderer plugin v2.
Also adds support sending a Device Scale Factor parameter to the 
plugin v2 remote rendering service and by that replaces #22474.
Adds support sending a Headers parameter to the plugin v2 and
remote rendering service which for now only include 
Accect-Language header (the user locale in browser when using 
Grafana), ref grafana/grafana-image-renderer#45.
Fixes health check json details response.
Adds image renderer plugin configuration settings in defaults.ini 
and sample.ini.

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-21 16:16:41 +02:00
Leonard Gram
8620b7c2aa
Search: raise service init prio (#23740) 2020-04-21 15:30:09 +02:00
Emil Tullstedt
b7809918f0
Dashboard: Update tests for testing fallback support (#23730) 2020-04-21 11:31:10 +02:00
Ryan McKinley
9464115fc0
TableCell: show JSON rather than [object Object] (#23683) 2020-04-20 11:10:03 -07:00
Emil Tullstedt
b669bfdf5f
Dashboard: Add failsafe for slug generation (#23709) 2020-04-20 18:17:33 +02:00
Jack Stevenson
c0635947e8
Add ServerlessDatabaseCapacity to AWS/RDS metrics (#23635) 2020-04-20 18:14:17 +02:00
Emil Tullstedt
83193aed3d
Search: Fix title search null pointer (#23705) 2020-04-20 17:29:35 +02:00
Emil Tullstedt
55c306eb6d
Refactor search (#23550)
Co-Authored-By: Arve Knudsen <arve.knudsen@grafana.com>
Co-Authored-By: Leonard Gram <leonard.gram@grafana.com>
2020-04-20 16:20:45 +02:00
Andrej Ocenas
e5dd7efdee
Provisioning: Allows specifying uid for datasource and use that in derived fields (#23585)
* Add uid to datasource

* Fix uid passing when provisioning

* Better error handling and Uid column type change

* Fix test and strict null error counts

* Add backend tests

* Add tests

* Fix strict null checks

* Update test

* Improve tests

* Update pkg/services/sqlstore/datasource.go

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Variable rename

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-20 15:48:38 +02:00
Carl Bergquist
46fd7c094b
Alertmanager: Basic auth should not be required (#23691) 2020-04-20 11:19:31 +02:00
Alexander Zobnin
f023e7a399
SAML Role and Team sync (open source part) (#23391)
* SAML: add default params for role and team sync

* SAML: add org_mapping option

* SAML: support allowed_organizations option

* Chore: expose RedirectWithError from HTTPServer

* Chore: return RedirectResponse (fix superfluous response.writeheader message)

* HTTPServer: expose ValidateRedirectTo() and CookieOptionsFromCfg()

* Config: move SAML section to the enterprise
2020-04-17 10:48:37 +03:00
Carl Bergquist
9652a1410b
Build: Stricter linting should break the build (#23606) 2020-04-16 16:09:27 +02:00
Marcus Efraimsson
ed51ce3ae1
Backend Plugins: Discard logged messages from logger named stdio (#23601)
Discard logged messages coming from backend plugin logger named 
stdio since that service is not in use. 

Fixes #23461
2020-04-16 13:08:07 +02:00
Carl Bergquist
5fc255bd89
Linting fixes for provisoning (#23600) 2020-04-16 05:46:20 +02:00
Marcus Efraimsson
6e313e7d37
Image Rendering: Remove PhantomJS support (#23460)
Removes all references and usage of PhantomJS #23375.
Remove direct link rendered image e2e smoke test for now.
Docker: Fix installing chrome in ubuntu custom docker image.
Improve handling of image renderer not available/installed #23593.
Add PhantomJS breaking change and upgrading notes.
Use grabpl v0.2.10.

Closes #13802

Co-authored-by: Kyle Brandt <kyle@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-04-15 22:17:41 +02:00
Marcus Efraimsson
2c36137457
Fix instantiation of plugin settings (#23583)
Forgot to instantiate plugin settings in #23451
2020-04-15 11:57:44 +02:00
Émile Fugulin
d721dd13cd
Allow API to assign new user to a specific organization (#21775)
* Allow API to assign new user to a specific organization

* Add defer block to test

* Add API tests and return 400 instead of 500 for bad orgId

* Minor test improvements
2020-04-15 12:11:45 +03:00
ilyastoli
b980cedfd5
CloudWatch: Added AWS Chatbot metrics and dimensions (#23516)
Adding AWS Chatbot metics according to https://docs.aws.amazon.com/chatbot/latest/adminguide/monitoring-cloudwatch.html
2020-04-15 10:35:21 +03:00
Carl Bergquist
80f40040b0
Linting fixes for dashboard provsioning (#23576) 2020-04-15 08:12:52 +02:00
Artur Kondas
9f2af718dc
Provisioning: Validate that dashboard providers have unique names (#22898)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
2020-04-14 20:54:00 +02:00
Marcus Efraimsson
34266cd369
Backend Plugins: Plugin configuration using Grafana config (#23451)
Enables adding a section `plugin.<plugin id>` and key/value to
Grafana configuration file which will be converted and sent
as environment variables to the backend plugin.
Also sends some additional environment variables, Grafana
version (GF_VERSION), Grafana edition (GF_EDITION) and 
enterprise license path (GF_ENTERPRISE_LICENSE_PATH).

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

Fixes #21515,
2020-04-14 18:04:27 +02:00
Hugo Häggmark
2661054fe8
Hangouts: fixes notifications for alerts with empty message (#23559)
* Hangouts: fixes notifications for alerts with empty message

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

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-04-14 15:02:58 +02:00
Ryan McKinley
aaab636bf4
Plugins: verify manifest signature (#23519)
* try decode

* vendor crypto deps

* commited missing vendor deps

* Theme: Refactoring theme colors variables  (#23513)

* Theme: Typography updates

* Updated

* Updated snapshot

* Renamed colors to palette

* Introduce colors namespace

* Massive theme color move

* Removing color selection logic with more abstract concepts

* Updates

* Minor sidemenu change

* Fix example jaeger agent port in docs (#23514)

* @grafana/ui: Replace various icons using Icon component (#23442)

* Replace icons in dashboard and settings

* Replace icons in alerting

* Update batch of icons

* Implement icons accross various files

* Style updates

* Search: Fix recent and starred icons

* Update styling and details

* Replace new icon created by unicons

* Fix e2e test, styling

* Minor styling updates

Co-authored-by: Clarity-89 <homes89@ukr.net>

* trying with p512 key

* trying with p512 key

* lint

* update with real signatures

* fixes spacing in test files

* remove convey from test

* use errutil to wrap errors

* removes print statement

* splitt tests into two run statements

* unexport plugin manifest struct

Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
Co-authored-by: Clarity-89 <homes89@ukr.net>
2020-04-14 06:02:39 -07:00
Carl Bergquist
754dfdfa87
Lower log level for some startup logs statements (#23517) 2020-04-14 12:18:45 +02:00
Ivana Huckova
1c58202b26
@grafana/ui: Replace various icons using Icon component (#23442)
* Replace icons in dashboard and settings

* Replace icons in alerting

* Update batch of icons

* Implement icons accross various files

* Style updates

* Search: Fix recent and starred icons

* Update styling and details

* Replace new icon created by unicons

* Fix e2e test, styling

* Minor styling updates

Co-authored-by: Clarity-89 <homes89@ukr.net>
2020-04-12 22:20:02 +02:00
Carl Bergquist
0fd5945542
Fixes linting errors in datasource provisioning. (#23515) 2020-04-11 21:07:07 +02:00
Torkel Ödegaard
5a4f690807
NewPanelEditor: Enable new edit mode (#23405)
* WIP: initial commit to transition to new edit mode

* More old edit cleanup

* Minor update

* Refactoring url edit/fullscreen state to simplify logic, now seperate states

* Fixed tests and part of the explore integration

* Updated snapshot

* Fix alert rule links

* Fixed issue going back from explore

* Updated snapshots

* Fixes and changes

* Fixed bridge srv issue

* Fixed add panel issue

* Removed console log

* Removed render

* Tests: fixes e2e smoketest

* Make description optional

* Fixed typings

* e2e fixes

* removed import

* updated snapshot

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
2020-04-10 16:37:26 +02:00
Ryan McKinley
a56615749a
Plugins: fix debug formatting when scanning for files (#23484) 2020-04-10 00:45:07 -07:00
Kyle Brandt
5153673884
BackendPlugins: update to sdk v0.42.0
misc cleanup
2020-04-09 15:47:30 -04:00
ilyastoli
692a73875b
CloudWatch: Added missing Cassandra metrics (#23467)
Adding missing CloudWatch metrics Cassandra
2020-04-09 17:08:28 +03:00
Carl Bergquist
a08cbbcc81
Instrument backend plugin requests (#23346) 2020-04-09 14:47:46 +02:00
Ryan
1f0e1b33bc
Postgres: Add SSL support for datasource (#21341)
* Add SSL certificate/key fields to Postgres data source configuration

Co-authored-by: Edwin Cordeiro <edwin@scordeiro.net>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-09 12:48:29 +02:00
Ryan McKinley
468f5d15ab
Plugins: add a signature status flag (#23420) 2020-04-09 00:00:16 -07:00
Dário Nascimento
7329671793
Cloudwatch: prefer webIdentity over EC2 role (#23452) 2020-04-08 23:58:32 -07:00
Patrik Karlström
dbda5aece9
cloudwatch: Replicate SDK behaviour for WebIdentityRole (#21594)
* Replicate SDK behaviour for WebIdentityRole

Fix #20473

* Use WebIdentityRole in s3 uploader as well

* Use consistent casing

* use WebIdentityRole to assume another role

Co-authored-by: eV <ev@7pr.xyz>
2020-04-08 15:05:24 +02:00
Ivana Huckova
431f454d57
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)

* Create a new Icon component

* Update icons in main sidebar

* Update icons in Useful links and in react components on  main site

* Update icons in Useful links and in main top navigation

* Adjust sizing

* Update panel navigation and timepicker

* Update icons in Panel menu

* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)

* Update icons in add panel widget

* Resolve merge conflict

* Fix part of the test errors and type errors

* Fix storybook errors

* Update getAvailableIcons import in storybook knobs

* Fix import path

* Fix SyntaxError: Cannot use import statement outside a module in test environment error

* Remove dynamic imports

* Remove types as using @ts-ignore

* Update snapshot test

* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax

* Remove color prop from icon, remove color implemetation in mono icons

* Update navbar styling

* Move toPascalCase to utils/string

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

* Resolve type errors resulted from merge

* Part2: Unicons implementation (#23266)

* Create a new Icon component

* Update icons in main sidebar

* Update icons in Useful links and in react components on  main site

* Update icons in Useful links and in main top navigation

* Adjust sizing

* Update panel navigation and timepicker

* Update icons in Panel menu

* Update icons in add panel widget

* Resolve merge conflict

* Fix part of the test errors and type errors

* Fix storybook errors

* Update getAvailableIcons import in storybook knobs

* Fix import path

* Fix SyntaxError: Cannot use import statement outside a module in test environment error

* Remove dynamic imports

* Remove types as using @ts-ignore

* Update snapshot test

* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax

* Implment icons in Tabs

* Implement icons in search items and  empty  list

* Update buttons

* Update button-related snapshot tests

* Update icons in modals and page headers

* Create anfular wrapper and update all icons on search screen

* Update sizing, remove colors, update snapshot tests

* Remove color prop from icon, remove color implemetation in mono icons

* Remove color props from monochrome icons

* Complete update of icons for search screen

* Update icons for infor tooltips, playlist, permissions

* Support temporarly font awesome icons used in enterprise grafana

* Part1: Unicons implementation (#23197)

* Create a new Icon component

* Update icons in main sidebar

* Update icons in Useful links and in react components on  main site

* Update icons in Useful links and in main top navigation

* Adjust sizing

* Update panel navigation and timepicker

* Update icons in Panel menu

* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)

* Update icons in add panel widget

* Resolve merge conflict

* Fix part of the test errors and type errors

* Fix storybook errors

* Update getAvailableIcons import in storybook knobs

* Fix import path

* Fix SyntaxError: Cannot use import statement outside a module in test environment error

* Remove dynamic imports

* Remove types as using @ts-ignore

* Update snapshot test

* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax

* Remove color prop from icon, remove color implemetation in mono icons

* Update navbar styling

* Move toPascalCase to utils/string

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

* Icons update

* Add optional chaining to for isFontAwesome variable

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

* Part3:  Unicons implementation (#23356)

* Create a new Icon component

* Update icons in main sidebar

* Update icons in Useful links and in react components on  main site

* Update icons in Useful links and in main top navigation

* Adjust sizing

* Update panel navigation and timepicker

* Update icons in Panel menu

* Update icons in add panel widget

* Resolve merge conflict

* Fix part of the test errors and type errors

* Fix storybook errors

* Update getAvailableIcons import in storybook knobs

* Fix import path

* Fix SyntaxError: Cannot use import statement outside a module in test environment error

* Remove dynamic imports

* Remove types as using @ts-ignore

* Update snapshot test

* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax

* Implment icons in Tabs

* Implement icons in search items and  empty  list

* Update buttons

* Update button-related snapshot tests

* Update icons in modals and page headers

* Create anfular wrapper and update all icons on search screen

* Update sizing, remove colors, update snapshot tests

* Remove color prop from icon, remove color implemetation in mono icons

* Remove color props from monochrome icons

* Complete update of icons for search screen

* Update icons for infor tooltips, playlist, permissions

* Support temporarly font awesome icons used in enterprise grafana

* Part1: Unicons implementation (#23197)

* Create a new Icon component

* Update icons in main sidebar

* Update icons in Useful links and in react components on  main site

* Update icons in Useful links and in main top navigation

* Adjust sizing

* Update panel navigation and timepicker

* Update icons in Panel menu

* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)

* Update icons in add panel widget

* Resolve merge conflict

* Fix part of the test errors and type errors

* Fix storybook errors

* Update getAvailableIcons import in storybook knobs

* Fix import path

* Fix SyntaxError: Cannot use import statement outside a module in test environment error

* Remove dynamic imports

* Remove types as using @ts-ignore

* Update snapshot test

* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax

* Remove color prop from icon, remove color implemetation in mono icons

* Update navbar styling

* Move toPascalCase to utils/string

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

* Update icons in Explore

* Update icons in alerting

* Update + and x buttons

* Update icons in configurations and settings

* Update close icons

* Update icons in rich history

* Update alert messages

* Add optional chaining to for isFontAwesome variable

* Remove icon mock, set up jest.config

* Fix navbar plus icon

* Fir enable-bacground to enableBackgournd

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

* Merge remote branch origin master to icons-unicons

* Revert "Merge remote branch origin master to icons-unicons"

This reverts commit 3f25d50a39.

* Size-up dashnav icons

* Fix alerting icons, panel headers, update tests

* Fix typecheck error

* Adjustments - add panel icon, spacing

* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 14:33:31 +02:00
Kyle Brandt
80729e9fb1
Chore: remove unused go package dynmap (#23409) 2020-04-07 14:58:10 -04:00
Kyle Brandt
f6cbb26167
BackendPlugin: Change QueryData response format (#23234)
* BackendPlugin: (wip) change response format
goes with https://github.com/grafana/grafana-plugin-sdk-go/pull/109

* fix error mapping in wrapper

* latest of my sdk branch

* latest of my sdk branch

* TransformWrapper fixes

* latest of sdk branch (removes extra meta)

* add metadata in wrappers

* also set error string

* sdk: v0.35.0
2020-04-07 10:13:14 -04:00
Ryan McKinley
03e3ddcbdb
Plugins: add a bundle plugins folder (#20850) 2020-04-07 00:04:24 -07:00
Dan Cech
2ecc7f22b9
delete old dashboard versions in multiple batches (#23348) 2020-04-06 11:44:14 -04:00
Erik Sundell
d94796a022
Auth: Remove trailing / in cookies' path (#22265) (#22265)
According to the stackoverflow answer below, it is recommended to not
include a trailing / in cookies' path. By removing the trailing / for
our cookies path value, people's browsers visiting grafana will pass the
cookie not only to /grafana/ sub paths but also to /grafana sub paths.

This commit avoids the situation where a user would visit
http://localhost/grafana, get redirected to
http://localhost/grafana/login, and following login get redirected back
to http://localhost/grafana, but since the grafana_session cookie isn't
passed along get redirected back once more to
http://localhost/grafana/login.

ref: https://stackoverflow.com/questions/36131023/setting-a-slash-on-cookie-path/53784228#53784228
ref: https://tools.ietf.org/html/rfc6265#section-5.1.4
2020-04-06 17:56:19 +03:00
Vikky Omkar
97184c1750
Fix: Show organization popup in alphabetical order (#22259)
* Show organization popup in alphabetical order
* GetUserOrgList: Sort organizations by name in API

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-06 13:27:11 +02:00
Agnès Toulet
56687a08f9
Core: use go-datemath in timerange utility (#23120)
* Core: use go-datemath in time_range

* Core: update timerange for negative epoch

* Core: update gtime component

* Core: clean up time_range tests

* Update pkg/components/gtime/gtime.go

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Core: clean gtime tests

* components/gtime: Fix test

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

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-06 09:00:05 +02:00
Arve Knudsen
0fd6edab64
services/sqlstore: Order results in UserSearch by username/email (#23328)
* services/sqlstore: Order results in UserSearch by username/email
* Add index (login,email) on user table
2020-04-03 19:15:10 +02:00
Arve Knudsen
5645d74cbc
Server: Exit with 0 if no error (#23312)
Make grafana-server exit with 0 if no error occurred.
2020-04-03 11:34:18 +02:00
Vikky Omkar
06ba5201bb
CloudWatch: Added Cassandra namespace (#23299) 2020-04-02 19:06:54 +03:00
Alexander Zobnin
7afdfd2ef4
Okta OAuth provider (team sync support) (#22972)
* Okta OAuth support

* Chore: fix linter error

* Chore: move IsEmailAllowed to SocialBase

* Chore: move IsSignupAllowed to SocialBase

* Chore: review fixes

* Okta: support allowed_groups

* Okta: default config

* Chore: move extractEmail() to OktaClaims struct

* Chore: review fixes

* generic_oauth_test: Handle error cases

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

* generic_oauth_test: Handle error cases

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

* Docs: Okta OAuth

* Chore: don't return expected errors from searchJSONForAttr

* Docs: role mapping

* Chore: review fixes (searchJSONForAttr)

* Docs: review fixes

* Update docs/sources/auth/okta.md

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Update docs/sources/auth/okta.md

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: log error if searchJSONForAttr failed

* Docs: add Okta login link

* Docs: review fixes

* Docs: add reference to the org roles

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-02 17:35:48 +03:00
Carl Bergquist
15bff3114f
Usagestats: Add usage stats about what type of datasource is used in alerting. (#23125) 2020-04-02 08:45:04 +02:00
John McBride
b017e437d8
Fix typo in oauth error (#23270)
fixes: #23269
2020-04-02 08:24:59 +02:00
Noval Agung Prayogo
ea35ae4d1f
Chore: Update the xorm dependency (#22376)
* Upgrade xorm

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-01 15:57:21 +02:00
melchiormoulin
1814dc5afc
Alertmanager: Adds support for basic auth (#23231)
Add basicauth username and password to the alertmanager notifier UI
2020-04-01 09:29:28 +02:00
Marcus Efraimsson
6bd7411f04
Alerting: Only include image in notifier when enabled (#23194)
Fixes a bug when you had multiple notifiers for a rule, but not all 
had enabled to include image.

Fixes #22883
2020-03-31 00:46:01 +02:00
rtrompier
474dac1501
OAuth : Introduce new setting for configuring max age of OAuth state cookie (#23195)
* Cookie : Increase duration to avoid error

When using oauth2 authentication with multifactor, the 60s delay may be too short

* Introduce new setting for OAuth state cookie max age

Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-03-30 17:44:58 +03:00
Erik Sundell
a111cc0d5c
Stackdriver: Support for SLO queries (#22917)
* wip: add slo support

* Export DataSourcePlugin

* wip: break out metric query editor into its own component

* wip: refactor frontend - keep SLO and Metric query in differnt objects

* wip - load services and slos

* Fix broken test

* Add interactive slo expression builder

* Change order of dropdowns

* Refactoring backend model. slo unit testing in progress

* Unit test migration and SLOs

* Cleanup SLO editor

* Simplify alias by component

* Support alias by for slos

* Support slos in variable queries

* Fix broken last query error

* Update Help section to include SLO aliases

* streamline datasource resource cache

* Break out api specific stuff in datasource to its own file

* Move get projects call to frontend

* Refactor api caching

* Unit test api service

* Fix lint go issue

* Fix typescript strict errors

* Fix test datasource

* Use budget fraction selector instead of budget

* Reset SLO when service is changed

* Handle error in case resource call returned no data

* Show real SLI display name

* Use unsafe prefix on will mount hook

* Store goal in query model since it will be used as soon as graph panel supports adding a threshold

* Add comment to describe why componentWillMount is used

* Interpolate sloid

* Break out SLO aggregation into its own func

* Also test group bys for metricquery test

* Remove not used type fields

* Remove annoying stackdriver prefix from error message

* Default view param to FULL

* Add part about SLO query builder in docs

* Use new images

* Fixes after feedback

* Add one more group by test

* Make stackdriver types internal

* Update docs/sources/features/datasources/stackdriver.md

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

* Update docs/sources/features/datasources/stackdriver.md

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

* Update docs/sources/features/datasources/stackdriver.md

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

* Updates after PR feedback

* add test for when no alias by defined

* fix infinite loop when newVariables feature flag is on

onChange being called in componentDidUpdate produces an
infinite loop when using the new React template variable
implementation.

Also fixes a spelling mistake

* implements feedback for documentation changes

* more doc changes

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Daniel Lee <dan.limerick@gmail.com>
2020-03-27 12:01:16 +01:00
Agnès Toulet
f63877f247
Core: Add go-datemath library (#22978) 2020-03-26 10:26:47 +01:00
huanggze
69c5efcf00
Cleanup: move interface ProvisioningService into provisioning package (#23061) 2020-03-25 14:14:24 +01:00
Andrej Ocenas
ae09ccbf79
Trace UI demo (#20297)
* Add integration with Jeager
Add Jaeger datasource and modify derived fields in loki to allow for opening a trace in Jager in separate split.
Modifies build so that this branch docker images are pushed to docker hub
Add a traceui dir with docker-compose and provision files for demoing.:wq

* Enable docker logger plugin to send logs to loki

* Add placeholder zipkin datasource

* Fixed rebase issues, added enhanceDataFrame to non-legacy code path

* Trace selector for jaeger query field

* Fix logs default mode for Loki

* Fix loading jaeger query field services on split

* Updated grafana image in traceui/compose file

* Fix prettier error

* Hide behind feature flag, clean up unused code.

* Fix tests

* Fix tests

* Cleanup code and review feedback

* Remove traceui directory

* Remove circle build changes

* Fix feature toggles object

* Fix merge issues

* Fix some null errors

* Fix test after strict null changes

* Review feedback fixes

* Fix toggle name

Co-authored-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
2020-03-25 12:25:39 +01:00
Marcus Efraimsson
b0253219eb
Use v0.33.0 of SDK (#23031) 2020-03-24 15:01:02 +01:00
Andrew Burian
7d9b6a0dee
Alerting: Enable Alert rule tags to override PagerDuty Severity setting (#22736) 2020-03-23 19:32:55 +01:00
Carl Bergquist
3798ac903d
Upgrade golangci-lint and fixes some linting errors. (#22909)
Example: https://play.golang.org/p/cfPIPG3BwjJ
2020-03-23 13:37:53 +01:00
Jon McKenzie
6c9d833602
AuthProxy: Fixes bug where long username could not be cached (#22926) 2020-03-20 21:50:27 +01:00
huanggze
aea3929154
Fix typo (#22923)
Signed-off-by: huanggze <loganhuang@yunify.com>
2020-03-20 12:46:07 +01:00
huanggze
87ffa258e7
cleanup: use unexported variable (#22908)
Signed-off-by: huanggze <loganhuang@yunify.com>
2020-03-20 09:40:14 +01:00
Denis
26626d9073
Prometheus: Render missing labels in legend formats as an empty string (#22355)
* Empty value for unknown Prometheus label (grafana#16041)

* Empty value for unknown Prometheus label (grafana#16041)

* fix linter
2020-03-18 19:57:11 +01:00
Arve Knudsen
bb05989e43
SQLStore: Add migration for adding index on annotation.alert_id (#22876) 2020-03-18 17:59:42 +01:00
Kyle Brandt
0e09a3fe15
Alerting: support alerting on data.Frame (that can be time series) (#22812)
data.Frame (that can be series) are converted to as tsdb.TimeSeriesSlice - so new backend plugins can be shimmed into existing alerting

use sdk v0.31.0
2020-03-18 10:30:07 -04:00
Dima Ryskin
44b7f3ea1c
AlertNotifications: Translate notifications IDs to UIDs in Rule builder (#19882)
* AlertNotifications: Translate notifications IDs to UIDs in alert Rule builder

* Avoid shadowing errors, raise validation error on non-existing notification id

* create a cache for notification Uids to minimize db overhead

* add cache usage test

* avoid caching empty notification Uids

* isolate db in alert notificationUid caching tests
2020-03-18 15:00:56 +02:00
Carl Bergquist
579abad9cc
Plugins: Return jsondetails as an json object instead of raw json on datasource healthchecks. (#22859) 2020-03-18 12:08:52 +01:00
Marcus Efraimsson
60e3437fc1
Backend plugins: Exclude plugin metrics in Grafana's metrics endpoint (#22857)
Excludes backend plugin metrics in Grafana's metrics endpoint
Adds /api/:pluginId/metrics endpoint for retrieving metrics
from backend plugin as Prometheus text-based exposition format.

Fixes #22814
2020-03-18 12:08:20 +01:00
Carl Bergquist
0a094a7319
Datasource config was not mapped for datasource healthcheck (#22848)
closes #22825
2020-03-17 16:59:47 +01:00
Carl Bergquist
b0407b3578
upgrades plugin sdk to 0.30.0 (#22846)
ref grafana/grafana-plugin-sdk-go#94
ref grafana/grafana-plugin-sdk-go#70
2020-03-17 16:58:52 +01:00
Dominik Prokop
f345d7f6a3
Plugins: Hide plugins page from viewers, and limit /api/plugins to only core plugins when called by viewer role (#21901)
* Hide plugins list from viewers

* Made /api/plugins only return core plugins for users with viewer role

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-03-16 15:40:46 +01:00
Ryan McKinley
c65db9bf25
Chore: remove expressions flag and allow (#22764) 2020-03-13 07:43:25 -07:00
Carl Bergquist
b1e112923b
aligns the severity dropdown with other fields (#22779) 2020-03-13 14:19:35 +01:00
Carl Bergquist
ebc9549cbc
Add support for sending health check to datasource plugins. (#22771)
closes #21519
ref grafana/grafana-plugin-sdk-go#93
2020-03-13 12:31:44 +01:00
Sofia Papagiannaki
be022d4239
API: Fix redirect issues (#22285)
* Revert "API: Fix redirect issue when configured to use a subpath (#21652)" (#22671)

This reverts commit 0e2d874ecf.

* Fix redirect validation (#22675)

* Chore: Add test for parse of app url and app sub url

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

* Fix redirect: prepend subpath only if it's missing (#22676)

* Validate redirect in login oauth (#22677)

* Fix invalid redirect for authenticated user (#22678)

* Login: Use correct path for OAuth logos

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-03-11 11:04:48 +02:00
Sofia Papagiannaki
c6829645c7
Graphite: Don't issue empty "select metric" queries (#22699)
* Don't issue empty "select metric" queries

* Update pkg/tsdb/graphite/graphite.go

Co-Authored-By: Carl Bergquist <carl.bergquist@gmail.com>

* Fix indentation

* Add missing import

Co-authored-by: Carl Bergquist <carl.bergquist@gmail.com>
2020-03-11 09:28:36 +01:00
Erik Sundell
763fb3bc32
CloudWatch: Expand alias variables when query yields no result (#22695)
* Return empty time series with expanded aliases in case query yielded no results

* PR feedback
2020-03-10 21:14:58 +01:00
Kyle Brandt
73c4bef70f
Dependency: sdk's dataframe package renamed to data (#22700)
* use sdk 0.24.0
2020-03-10 15:42:15 -04:00
Carl Bergquist
5f94d31da9
Send jsondata for Datasources on DatasourceConfig for backend plugins (#22681)
ref https://github.com/grafana/grafana-plugin-sdk-go/pull/84
2020-03-10 15:18:27 +01:00
Torkel Ödegaard
da37f4c83f
XSS: Fixed history XSS issue (#22680) 2020-03-10 14:56:27 +01:00
Erik Sundell
cd012bdfb4
Fix caching problem (#22473) 2020-03-10 14:10:48 +01:00
Marcus Efraimsson
c12245bbb3
Backend plugins: Updates due to changes in SDK (#22649)
Use v0.20.0 of SDK
2020-03-10 12:59:03 +01:00
Chad Nedzlek
0e7c746a87
Azure Monitor: Fix app insights source to allow for new __timeFrom and __timeTo (#21879)
* Fix app insights source to allow for new __timeFrom and __timeTo

* Try fixing the switch
2020-03-10 00:55:41 +01:00
Carl Bergquist
1dcfaf25fc
Adds signed in user to backend v2 plugins requests (#22584)
closes #12043
2020-03-06 14:37:36 +01:00
Jeet Parekh
c73a0007c7
CloudWatch: updated namespaces - Athena, DocDB, and Route53Resolver (#22604) 2020-03-06 10:41:29 +02:00
Marcus Efraimsson
4ff613a432
Backend Plugins: Support handling of streaming resource response (#22580)
Use v0.19.0 of SDK.
Support handling of streaming resource response.
Disable gzip/compression middleware for resources 
to allow chunked/streaming response to clients the gzip
middleware had to be disabled since it buffers the full
response before sending it to the client.

Closes #22569

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-03-06 01:44:07 +07:00
Daniel Lee
f95c8b785c
Stackdriver: Migrate GCE default project (#22593)
* Ensure default project

* Remove debug logging

* Fix broken test

* Update snapshot
2020-03-05 17:53:41 +01:00
Erik Sundell
0f8cfca4e6
surround CloudWatch dimension names with double quotes (#22222) 2020-03-05 14:15:45 +01:00
Agnès Toulet
ea3d368e91
Core: add active users stat (#22563)
* Stats: add active user count query

* License: add info in settings

* Stats: Retrieve active users stats for different roles

+ Clean files and tests

* Stats: add dialect.Quote in queries

* Stats: improve tests (require instead of assert)

* Stats: improve tests (require instead of assert)
2020-03-05 12:34:44 +01:00
Carl Bergquist
766d8a5888
avoid aliased import in cli (#22566) 2020-03-04 13:18:13 +01:00
Carl Bergquist
3fdd2648b1
Chore: Avoid aliasing importing models in api package (#22492) 2020-03-04 12:57:20 +01:00
Ricardo
c3884abf62
Add fallback to search_base_dns if group_search_base_dns is undefined. (#21263)
* Add fallback to search_base_dns if group_search_base_dns is undefined.

refs: #20862

* removed newline to make lint-go happy

* Added requested changes on ldap.md for last commit

Refs: #21263
2020-03-03 09:11:16 -08:00
Marcus Efraimsson
e6cec8dbdc
Backend plugins: Prepare and clean request headers before resource calls (#22321)
Moves common request proxy utilities to proxyutil package with
support for removing X-Forwarded-Host, X-Forwarded-Port,
X-Forwarded-Proto headers, setting X-Forwarded-For header
and cleaning Cookie header.
Using the proxyutil package to prepare and clean request
headers before resource calls.

Closes #21512
2020-03-03 11:45:16 +01:00
Erik Sundell
934a8f08ae
Stackdriver: Project selector (#22447)
* clean PR #17366

* udpate vendor

* [WIP] Implement projects management for stackdriver

* [WIP] Implement projects management for stackdriver

* [WIP] Implement projects management for stackdriver

* Implement projects management for stackdriver

* [WIP][Tests] Fix errors

* clean anonymous struct

* remove await

* don't store project list

* Add default project on query editor

* gofmt

* Fix tests

* Move test data source to backend

* Use segment instead of dropdown. remove ensure default project since it's not being used anymore.

* Fix broken annotation editor

* Load gceDefaultAccount only once when in the config page

* Reset error message on auth type change

* Add metric find query for projects

* Remove debug code

* Fix broken tests

* Fix typings

* Fix lint error

* Slightly different approach - now having a distiction between config page default project, and project that is selectable from the dropdown in the query editor.

* Fix broken tests

* Attempt to fix strict ts errors

* Prevent state from being set multiple times

* Remove noOptionsMessage since it seems to be obosolete in react select

* One more attempt to solve ts strict error

* Interpolate project template variable. Make sure its loaded correctly when opening variable query editor first time

* Implicit any fix

* fix: typescript strict null check fixes

* Return empty array in case project endpoint fails

* Rename project to projectName to prevent clashing with legacy query prop

* Fix broken test

* fix: Stackdriver - template replace on filter label

should have a regex format as that escapes the dots
in the label name which is not valid.

Co-authored-by: Labesse Kévin <kevin@labesse.me>
Co-authored-by: Elias Cédric Laouiti <elias@abtasty.com>
Co-authored-by: Daniel Lee <dan.limerick@gmail.com>
2020-03-02 09:31:09 -05:00
Mohit Gupta
94951df1c1
API: Include IP address when logging request error (#21596)
Includes IP address when logging request error, for example 
when a user fails to login.

Fixes #21310
2020-03-02 09:43:16 +01:00
Carl Bergquist
f9962eabff
chore: avoid aliasing imports in services (#22499) 2020-02-29 13:35:15 +01:00
lfroment
72628c8ea0
Dashboard: Adds support for a global minimum dashboard refresh interval (#19416)
This feature would provide a way for administrators to limit the minimum 
dashboard refresh interval globally.
Filters out the refresh intervals available in the time picker that are lower 
than the set minimum refresh interval in the configuration .ini file
Adds the minimum refresh interval as available in the time picker.
If the user tries to enter a refresh interval that is lower than the minimum 
in the URL, defaults to the minimum interval.
When trying to update the JSON via the API, rejects the update if the 
dashboard's refresh interval is lower than the minimum.
When trying to update a dashboard via provisioning having a lower 
refresh interval than the minimum, defaults to the minimum interval 
and logs a warning. 

Fixes #3356

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-02-28 14:32:01 +01:00
Carl Bergquist
67ec9edcc8
chore: avoid alias for models in plugins (#22483) 2020-02-28 12:51:21 +01:00
Carl Bergquist
f2f2722bb1
chore: avoid aliasing models in middleware (#22484) 2020-02-28 12:50:58 +01:00
Vikky Omkar
066d5cf4da
Alerting: Fixed the issue/bug of diff and percent_diff functions *Breaking change* (#21338)
fixes #16270 #10129
2020-02-27 20:25:03 +01:00
Ryan McKinley
0606555ba1
App Plugins: support react pages in nav (#22428) 2020-02-27 09:10:21 -08:00
Martin
cffcc95be0
pkg/api/pluginproxy: Access token provider should handle access tokens without ExpiresOn field (#19928)
* pkg/api/pluginproxy: Add support for expire_in field in access-token

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-02-26 15:59:02 +01:00
Arve Knudsen
eb98d9c15b
grafana-cli: Upgrade to urfave/cli v2 (#22402)
* grafana-cli: Upgrade to urfave/cli v2
2020-02-26 12:27:31 +01:00
Agnès Toulet
1dd404a1fb
Core: Make application title customizable for WL (#22401)
* Core: Add custom app title

* Docs: Update White Labeling title customization

* Core: set back export for Branding types
2020-02-25 15:18:37 +01:00
Arve Knudsen
bf908424a7
Alerting: Don't include image_url field with Slack message if empty (#22372) 2020-02-21 15:43:54 +01:00
Marcus Efraimsson
d0a80c59f3
Rendering: Store render key in remote cache (#22031)
By storing render key in remote cache it will enable
image renderer to use public facing url or load
balancer url to render images and thereby remove
the requirement of image renderer having to use the
url of the originating Grafana instance when running
HA setup (multiple Grafana instances).

Fixes #17704
Ref grafana/grafana-image-renderer#91
2020-02-19 19:47:39 +01:00
Marcus Efraimsson
9d7c74ef91
Backend Plugins: Provide proper plugin config to plugins (#21985)
Properly provides plugin configs to backend plugins.
Uses v0.16.0 of grafana-plugin-sdk-go-

Ref #21512
Ref #19667
2020-02-19 19:17:05 +01:00
Carl Bergquist
b0b46991ec
Metrics: Add gauge for requests currently in flight (#22168)
Add gauge for requests currently in flight.

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-02-19 18:29:47 +01:00
Arve Knudsen
8d1bef3769
OAuth: Enforce auto_assign_org_id setting when role mapping enabled using Generic OAuth (#22268)
* OAuth: Make use of auto_assign_org_id setting
2020-02-19 17:38:53 +01:00
Marcus Efraimsson
fd52570b7f
API: Improve recovery middleware when response already been written (#22256)
Suppresses stacktrace in recovery middleware if error is
http.ErrAbortHandler.
Skips writing response error in recovery middleware if
resoonse have already been written.
Skips try rotate of auth token if response have already
been written.
Skips adding default response headers if response have
already been written.

Fixes #15728
Ref #18082

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-02-18 22:53:40 +01:00
Adrian Coveney
39e0ce305b
Reorder cipher suites for better security (#22101)
Put the cipher suites with Forward Secrecy at or nearer the top, keeping any TLS v1.3 suites at the top, following best practice guides for the ordering of the rest. There is no change to the selection of suites only reordering.
2020-02-18 18:58:36 +01:00
Carl Bergquist
ff9556229a
Data proxy: Log proxy errors using Grafana logger (#22174)
Now any errors logged by http.ReverseProxy are forwarded to 
Grafana's logger and includes more contextual information like
level (error), user id, org id, username, proxy path, referer and 
IP address.

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-02-18 13:26:01 +01:00
Carl Bergquist
fe16028e02
Auth: Don't rotate auth token when requests are cancelled by client (#22106)
if the client closes the connection we should not
rotate token since the client will never receive the
new token.

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-02-17 17:31:44 +01:00
Leonard Gram
10fbabfb2e
Sqlstore: guard against getting a dashboard without specifying identi… (#22246)
* Sqlstore: guard against getting a dashboard without specifying identifier

* Sqlstore: linting
2020-02-17 15:32:20 +01:00
Tobias Skarhed
0c4dae321c
Migrations: Signup page (#21514)
* Start Angular migration

* Add SignupCtrl

* Change name signup

* Add backend call

* Put form in separate file

* Add form model

* Start using react-hook-forms

* Add FormModel to state

* Reduxify

* Connect nav with Redux

* Fix routing and navModel

* Fetch state options on mount

* Add default values and add button margin

* Add errror messages

* Fix title

* Remove files and cleanup

* Add Signup tests

* Add boot config assingnAutoOrg and verifyEmailEnabled

* Remove onmount call

* Remove ctrl and move everything to SignupForm

* Make routeParams optional for testing

* Remove name if it is empty

* Set username

* Make function component

* Fix subpath issues and add link button

* Move redux to SignupPage
2020-02-17 11:13:13 +01:00
Martin Passing
90541d3084
add CloudWatch Usage Metrics (#22179)
https://docs.amazonaws.cn/en_us/AmazonCloudWatch/latest/monitoring/CloudWatch-Usage-Metrics.html
2020-02-16 18:07:28 +01:00
Arve Knudsen
019834ae12
Alerting: Update the types of recipient supported by the Slack notifier (#22205)
* Alerting: Update types of supported Slack recipients
* Document Slack recipient requirements
2020-02-14 17:11:23 +01:00
Brian Gann
0e2d874ecf
API: Fix redirect issue when configured to use a subpath (#21652)
* request uri will contain the subpath
2020-02-14 14:51:35 +01:00
Alexander Zobnin
f2fc7aa3aa
Azure OAuth: enable teamsync (#22160)
* Azure OAuth: extract groups from token for teamsync

* Docs: changed some headers

* Azure OAuth: fix tests

* Azure OAuth: fix linter error (simplify)

* Azure OAuth: add allowed_groups option

* Azure OAuth: docs for team sync and allowed_groups

* Azure OAuth: tests for allowed_groups

* Update docs/sources/auth/azuread.md

Co-Authored-By: Leonard Gram <leo@xlson.com>

Co-authored-by: Leonard Gram <leo@xlson.com>
2020-02-14 14:03:00 +03:00
twendt
ff6a082e23
Auth: Azure AD OAuth (#20030)
* Implement Azure AD oauth

* Use go-jose and cleanup

* Update go-jose in go.mod

* cleanup

* Add unit tests

* Fix scopes

* Add documentation page

* Improve documentation

* Convert extract_role into function.

* Do not use upn and replace unique_name with preferred_username

* Configure login button

* Use official microsoft icon and color from branding guideline.

* Add Azure AD config section in sample.ini.
2020-02-13 12:12:25 +03:00
Arve Knudsen
6f09bc9fb4
Fix mentioning Slack users/groups (#21734)
* alerting/slack: Allow mentioning users, groups, and channels separately
2020-02-11 21:43:28 +01:00
Andrii Melnyk
47314d0f13
Alerting: Handle NaN in reducers (#22053)
- Fix bug with NaN in alerting - Closes #21953
- Alert reducers (avg/max/etc) drop null values from their calculation. This change makes it so NaN values are handled in the same way as null values.
2020-02-10 19:28:07 -05:00
Marcus Efraimsson
679acd30ba
Backend Plugins: make transform work again (#22078) 2020-02-10 12:17:54 -05:00
Marcus Efraimsson
285ebd3413
Chore: Resolve random failure with golangci-lint (#21970) 2020-02-07 15:53:03 +01:00
Leonard Gram
59530e4758
Quota: Makes sure we provide the request context to the quota service (#21949)
It was missing for ldap_login which means that the first signup failed
for users with LDAP+quota enabled. There's also potential cases where we
can't provide a request context (background jobs) which is also covered,
but needs a refactoring.
2020-02-06 08:49:58 +02:00
Sofia Papagiannaki
5ae95190ed
Annotations: Change indices and rewrites annotation find query to improve database query performance (#21915)
Drop indices and create new ones and rewrites annotation find query 
to address performance issues when querying annotation table and 
there is a large amount of rows.

Fixes #21902

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
2020-02-05 16:52:41 +01:00
Mark Carey
28230bbf52
Metrics: Adds back missing summary quantiles (#21858)
Adds back missing summary quantiles which was mistakenly
removed in v6.6.0. 

Fixes #21857
2020-02-05 11:11:14 +01:00
jianweizhang
140e267639
delete redundant alias (#21907)
* delete redundant alias

Fixes #21906
2020-02-05 09:00:40 +01:00
Marcus Efraimsson
0390b5601e
Backend plugins: Implement support for resources (#21805)
Implements initial support for resources using v0.14.0 of SDK.

Ref #21512
2020-01-31 11:15:50 +01:00
Marcus Efraimsson
6e80315531
Image Rendering: Fix render of graph panel legend aligned to the right using Grafana image renderer plugin/service (#21854)
Don't render class body--phantomjs on body element when 
PhantomJS renderer not is in use.

Fixes #21830
2020-01-30 17:35:32 +01:00
Carl Bergquist
5dbd7c9e58
Add link guide for installing new renderer (#21702) 2020-01-28 10:57:55 +01:00
Emil Tullstedt
3fabbbff4d
Footer: Display Grafana edition (#21717)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-27 09:24:44 +01:00
Marcus Efraimsson
63a912629d
Admin: Viewer should not see link to teams in side menu (#21716)
Fixes so that viewers don't see a link to teams in side menu when
editors_can_admin setting is enabled.
2020-01-24 12:00:52 +01:00
John Dyer
0fcb2d0b2f Alerting: Support passing tags to Pagerduty and allow notification on specific event categories (#21335)
Add support for passing tags to Pagerduty and allow notification 
on specific event categories such as Class, Group and Component.

Ref #19912, #19913

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-01-23 13:20:07 +01:00
Sofia Papagiannaki
2283ceec09
SQLStore: Fix PostgreSQL failure to create organisation for first time (#21648)
* Fix PostgreSQL failure to create organisation for first time

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-01-22 17:56:12 +02:00
Erik Sundell
685c9043a8
CloudWatch: Auto period snap to next higher period (#21659)
* Snap to next higher period instead of closest

* Adjust period calc
2020-01-22 13:43:36 +01:00
kenju
935d447c6a CloudWatch: Add DynamoDB Accelerator (DAX) metrics & dimensions (#21644)
Closes #10494
2020-01-21 15:19:39 +01:00
Ryan McKinley
5f14d62c0d
TestData: allow negative values for random_walk parameters (#21627) 2020-01-20 10:50:42 -08:00
Erik Sundell
a1733bb412
CloudWatch: Expand dimension value in alias correctly (#21626)
* Make sure dimension value is being returned, and not just label

* Fix typo
2020-01-20 18:51:32 +01:00
Torkel Ödegaard
2732aca05c
TestData: Adds important new features to the random walk scenario (#21613)
* test data refactor

* new random walk options

* fixed test

* Added automatic names
2020-01-20 12:42:42 +01:00
Marcus Efraimsson
d2b08c8368
Render: Use https as protocol when rendering if HTTP2 enabled (#21600)
This fixes so that protocol is https instead of h2 when rendering
image if Grafana is configured to use HTTP2.

Ref grafana/grafana-image-renderer#77
2020-01-20 00:43:02 +01:00
Sean Johnson
7cbf3d8dab OAuth: Fix role mapping from id token (#20300)
As part of the new improvements to JMESPath in #17149 a 
commit ensuring Role and Email data could be queried from 
id_token was lost.
This refactors and fixes extracting from both token and user 
info api consistently where before only either token or 
either user info api was used for extracting data/attributes.

Fixes #20243

Co-authored-by: Timo Wendt <timo@tjwendt.de>
Co-authored-by: twendt <timo@tjwendt.de>
Co-authored-by: henninge <henning@eggers.name>
Co-Authored-by: Henning Eggers <henning.eggers@inovex.de>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-01-17 18:57:23 +01:00
Marcus Efraimsson
59469e14cf
CloudWatch: Fix ordering of map to resolve flaky test take 2 (#21577) 2020-01-17 16:30:42 +01:00
Marcus Efraimsson
303bbb9900
CloudWatch: Fix ordering of map to resolve flaky test (#21572) 2020-01-17 15:27:03 +01:00
Erik Sundell
8616f1beac Chore: Fix go vet problem (#21568) 2020-01-17 13:48:09 +01:00
Marcus Efraimsson
ca84829647
Provisioning: Start provision dashboards after Grafana server have started (#21564)
6.2-beta1 changed so that data sources, dashboards and alert notifiers 
are provisioned on service Init where's before only data sources and 
alert notifiers was provisioned on service Init and dashboards was first
provisioned in service Run which happens after Grafana server have 
started.
This change reverts so that dashboard provisioning are first happening 
in service Run, after Grafana server have started.

Fixes #21133
2020-01-17 13:39:41 +01:00
Erik Sundell
d40b66f1c1
CloudWatch: Calculate period based on time range (#21471)
* Calculate min period based on time range and no of queries

* Use hardcoded array of periods if period is not defined actively by the user

* Fix broken tests

* Use a smaller max period for auto interval

* Fix broken tests

* Test period calculation

* Test min retention period

* Fix broken test
2020-01-17 13:22:43 +01:00
Erik Sundell
b398bc592b
CloudWatch: Multi-valued template variable dimension alias fix (#21541)
* Match dimension value with label substring

* Add unit tests
2020-01-17 12:47:40 +01:00
Erik Sundell
260239d98b
Stackdriver: Support meta labels (#21373)
* Rewrite angular segments for filter and group by in react

* wip: refactoring

* Update metric find queries

* Remove old maps used to create labels - use one map for all types instead

* Use value as label (again) for filters ang groupby

* Remove old filter

* Remove not used code

* Fixes after pr feedback

* Fix broken tests and add new metadata tests

* Add index file to make imports cleaner

* Cleanup. Remove old angular filter code

* Fix broken tests

* Use type switching instead of if statements

* Use globals for regex

* Updates after pr feedback

* Make sure it's possible to filter using the same key multiple times

* Replace metric select with segment component

* Pass template vars as props

* Refactor meta labels code

* Reorder template variables

* Fix broken tests

* Reset metric value when changing service

* Fix lint issue.

* Make tests independant of element order

* Include kubernetes.io in regex

* Add instruction in help section
2020-01-17 12:25:47 +01:00
Marcus Efraimsson
71ffd1d108
Alerting: Fix image rendering and uploading timeout preventing to send alert notifications (#21536)
* svc alerting - use a shorter ctx to upload the img
This will prevent timeout on img upload to cancel the notifications from being sent

* components img uploader - pass the ctx to aws lib

* make webdavuploader use the ctx

* make azureblobuploader use the ctx

* rename uploadImage() to renderAndUploadImage()
for better clarity about what this method work

* Use timeout + 2s for plugin renderer (same as service and phantomjs)

* Make sure that original EvalContext is updated after render and upload

* Verify notification sent even if render or image upload times out

* fix lint

* fixes after review

Co-authored-by: Edouard Hur <3418467+hekmon@users.noreply.github.com>

Fixes #21018
2020-01-17 12:07:16 +01:00
Erik Sundell
20aac7f04b
CloudWatch: Display partial result in graph when max DP/call limit is reached (#21533)
* Return data and warning in case dp limit is reached

* Change warning text
2020-01-17 11:18:28 +01:00
Torkel Ödegaard
15b2bf3e5c
Dashboards: Default Home Dashboard Update (#21534)
* HomeLinks: WIP panel for getting started links

* Progress

* progress

* Updated styling

* Updated default home dashboard

* Update light card styles

* Tweaks based on feedback
2020-01-17 09:43:17 +01:00
Erik Sundell
a35b2ac463
CloudWatch: Annotation Editor rewrite (#20765)
* wip: react rewrite

* Cleanup

* Break out non annontations specific fields

* Cleanup. Make annontations editor a functional component

* Remove redundant classnames

* Add paneldata to props

* Cleanup

* Fix rebase merge problem

* Updates after pr feedback

* Fix conflict with master
2020-01-15 16:38:15 +01:00
Emil Tullstedt
29687903f8
Admin: Add promotional page for Grafana Enterprise (#21422)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-15 14:50:44 +01:00
Marcus Efraimsson
5c711bfb79
Backend Plugins: Collect and expose metrics and plugin process health check (#21481)
Adds support for collecting metrics from backend plugins and 
exposing them thru Grafana's Prometheus metrics endpoint. 
Enables to check health of backend plugin by using the route
`/api/plugins/<plugin id>/health`.
Uses sdk v0.6.0.

Closes #20984
2020-01-15 13:10:48 +01:00
Anthony Woods
f56f54b1a3 Auth: Rotate auth tokens at the end of requests (#21347)
By rotating the auth tokens at the end of the request we ensure
that there is minimum delay between a new token being generated
and the client receiving it.
Adds auth token slow load test which uses random latency for all 
tsdb queries..
Cleans up datasource proxy response handling.
DefaultHandler in middleware tests should write a response, the 
responseWriter BeforeFuncs wont get executed unless a response
is written.

Fixes #18644 

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-01-15 13:03:12 +01:00
Marcus Efraimsson
54c9b11ae8
Fix importing plugin dashboards (#21501)
#21350 introduced a bug regarding import of plugin dashboards. 
This should fix this and add custom validation if not importing 
plugin dashboard and dashboard property is missing.

Ref #21350

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
2020-01-15 12:10:02 +01:00
Marcus Efraimsson
a1579283a6
Add disabled option for cookie samesite attribute (#21472)
Breaking change: If disabled the cookie samesite cookie attribute
will not be set, but if none the attribute will be set and is a
breaking change compared to before where none did not render the
attribute. This was due to a known issue in Safari.

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
Co-Authored-By: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

Fixes #19847
2020-01-14 17:41:54 +01:00
Marcus Efraimsson
492912845f
Chore: Adds basic alerting notification service tests (#21467)
Adds basic alerting notification tests. First steps towards 
getting #18011 merged.

Ref #18011
2020-01-14 17:27:16 +01:00
Arve Knudsen
d26075644c
ImportDashboardCommand: Validate JSON fields (#21350)
* ImportDashboardCommand: Validate JSON fields
2020-01-14 16:26:54 +01:00
Sofia Papagiannaki
d135f1229d
Alerting: new min_interval_seconds options to enforce a minimum eval frequency (#21188)
* add min_interval_seconds setting to alerting config

It will let operator enforce a minimum time for the scheduler to enqueue evaluations

* Introduce UI modifications

* Update docs

Co-authored-by: Martin <uepoch@users.noreply.github.com>
2020-01-14 11:13:34 +02:00
zabullet
bcac76f5d4 Alerting: Enable setting of OpsGenie priority via a tag (#21298)
OpsGenie's model works heavily off of the priority of an alert, 
e.g. routing and escalation. Currently this plugin only supports 
the default "P3".
Setting a tag og_priority to the correct P-value, e.g. P1, P2, P3, 
P4 or P5, will call the OpsGenie API with the correct priority value 
set.
2020-01-13 21:04:24 +01:00
Alvaro Olmedo Rodriguez
abc806e17b Alerting: fallbackText added to Google Chat notifier (#21464)
Add fallbackText to Google Chat notifications. 
Definition of fallbackText: A plain-text description of the message's 
cards, used when the actual cards cannot be displayed, 
e.g. mobile notifications.

Fixes #21463
2020-01-13 20:42:52 +01:00
Marcus Efraimsson
1a810ebfe4
Plugins: Move backend plugin manager to service (#21474)
Moves backend plugin manager to service instead of
global functions in backendplugin package.

Closes #20053
2020-01-13 20:18:45 +01:00
Marcus Efraimsson
bb849d53bf
Backend Plugins: Refactor backend plugin registration and start (#21452)
Moves the details of loading plugins into the backend
plugin manager from the respective plugin (datasource,
transform and renderer).
2020-01-13 17:13:17 +01:00
Alexander Zobnin
8505d90768 Admin: New Admin User page (#20498)
* admin: user page to react WIP

* admin user page: basic view

* admin user page: refactor, extract orgs and permissions components

* admin user: change sessions actions styles

* admin user: add disable button

* user admin: add change grafana admin action

* user admin: able to change org role and remove org

* user admin: confirm force logout

* user admin: change org button style

* user admin: add confirm modals for critical actions

* user admin: lock down ldap user info

* user admin: align with latest design changes

* user admin: add LDAP sync

* admin user: confirm button

* user admin: add to org modal

* user admin: fix ConfirmButton story

* admin user: handle grafana admin change

* ConfirmButton: make styled component

* ConfirmButton: completely styled component

* User Admin: permissions section refactor

* admin user: refactor (orgs and sessions)

* ConfirmButton: able to set confirm variant

* admin user: inline org removal

* admin user: show ldap sync info only for ldap users

* admin user: edit profile

* ConfirmButton: some fixes after review

* Chore: fix storybook build

* admin user: rename handlers

* admin user: remove LdapUserPage import from routes

* Chore: fix ConfirmButton tests

* Chore: fix user api endpoint tests

* Chore: update failed test snapshots

* admin user: redux actions WIP

* admin user: use new ConfirmModal component for user profile

* admin user: use new ConfirmModal component for sessions

* admin user: use lockMessage

* ConfirmButton: use primary button as default

* admin user: fix ActionButton color

* UI: use Icon component for Modal

* UI: refactor ConfirmModal after Modal changes

* UI: add link button variant

* UI: able to use custom ConfirmButton

* Chore: fix type errors after ConfirmButton refactor

* Chore: revert Graph component changes (works with TS 3.7)

* Chore: use Forms.Button instead of ActionButton

* admin user: align items

* admin user: align add to org modal

* UI: organization picker component

* admin user: use org picker for AddToOrgModal

* admin user: org actions

* admin user: connect sessions actions

* admin user: updateUserPermissions action

* admin user: enable delete user action

* admin user: sync ldap user

* Chore: refactor, remove unused code

* Chore: refactor, move api calls to actions

* admin user: set user password action

* Chore: refactor, remove unused components

* admin user: set input focus on edit

* admin user: pass user into debug LDAP mapping

* UserAdminPage: Ux changes

* UserAdminPage: align buttons to the left

* UserAdminPage: align delete user button

* UserAdminPage: swap add to org modal buttons

* UserAdminPage: set password field to empty when editing

* UserAdminPage: fix tests

* Updated button border

* Chore: fix ConfirmButton after changes introduced in #21092

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-13 17:10:19 +01:00
Torkel Ödegaard
35679d4689
Logos: Refactoring a bit how logos are rendered (#21421) 2020-01-10 22:15:16 +01:00
Marcus Efraimsson
0f0772b629
Alerting: Adds support for sending a single email to all recipients in notification channel (#21091)
When an alert is sent by e-mail, the process sends an e-mail to 
each recipient separately. This PR is a single delivery to all recipients.
For companies that use e-mail extensively, this is necessary in order 
not to overload the sending queue.

Replaces #18013
Fixes #12650

Co-authored-by: Henrique Oliveira <holiiveira@users.noreply.github.com>
2020-01-10 16:06:33 +01:00
Danilo Bargen
8a02fa7691 ThreemaNotifier: Use fully qualified status emoji (#21305) 2020-01-10 16:00:20 +01:00
Leonard Gram
673ccdc448
Settings: Env override support for dynamic settings (#21439)
* Settings: supports env overrrides for dynamic settings

* Settings: makes it possible to explicitly get env override support for dynamic settings

* Make linter happy
2020-01-10 15:33:54 +01:00
Jeffrey Descan
c5f906f472 Security: refactor 'redirect_to' cookie to use 'Secure' flag (#19787)
* Refactor redirect_to cookie with secure flag in middleware

* Refactor redirect_to cookie with secure flag in api/login

* Refactor redirect_to cookie with secure flag in api/login_oauth

* Removed the deletion of 'Set-Cookie' header to prevent logout

* Removed the deletion of 'Set-Cookie' at top of api/login.go

* Add HttpOnly flag on redirect_to cookies where missing

* Refactor duplicated code

* Add tests

* Refactor cookie options

* Replace local function for deleting cookie

* Delete redundant calls

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2020-01-10 15:55:30 +02:00
Pavlos Daoglou
53007e07e3 ApiUser: Fix response when enabling, disabling or deleting a nonexistent user (#21391)
* ApiUser: Fix response when enabling, disabling or deleting a nonexistent user
2020-01-10 11:43:44 +01:00
Torkel Ödegaard
91ea3b15fa
Footer: Single footer component for both react & angular pages (#21389)
* Footer: Single footer implementation for both react & angular pages

* Export type

* Updates

* Use footer links in help menu

* Updates & Fixes

* Updated snapshot

* updated snapshot
2020-01-09 11:25:52 +01:00
vikkyomkar
3866f609ce API: Added alert state validation before changing its state (#21375)
* added alert state validation before changing its state

* modified boolean condition

* converted most occurring string into const

* referred the const of alert models
2020-01-09 11:18:51 +01:00
Marcus Efraimsson
baba1634b8 Plugins: Use grafana-plugin-sdk-go v0.5.0 (#21116)
* fix dispense

* plugin loading refactor

Moves common functionality of registering, starting,
stopping and restarting backend plugins to
backendplugin package.

* simplify plugin descriptors

* target sdk v0.5.0

Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
2020-01-08 11:43:28 -05:00
Erik Sundell
cf2dd51827
CloudWatch: dimension_values templating fix (#21401)
* Handle dimension value if passed as array

* Break out dimension value loading into its own func
2020-01-08 12:24:10 +01:00
Boris Granveaud
b8b618241e Rendering: Fix panel PNG rendering when using sub url & serve_from_sub_path = true (#21306)
* Rendering: fix dashboard rendering when using sub url

* rollback on render.go: no need to add sub-path
2020-01-06 08:12:18 +01:00
Paul Emmerich
42032f6c03 ImgUploader: add support for non-amazon S3 (#20354)
* imguploader: add support for non-Amazon S3 endpoints and forcing of path-style S3 addressing

fixes #11240

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-01-02 15:10:20 +01:00
Zach Bagnall
d0360de8f1 Alerting: Add configurable severity support for PagerDuty notifier (#19425)
* Pagerduty notifier: configurable severity

Instead of hardcoding `critical` make it configurable per notification channel instance.

* fix html

* Add a test to ensure default severity is correct

* Notifications doc

* Add a non-default test

* Add err check on NewJson (all tests)

* Add default severity (critical) to AlertNotificationEditCtrl class
2019-12-24 09:32:05 +02:00
Ryan McKinley
104c2e3636 Metrictank: fix bundled dashboard (#21209)
* update metrictank dashboard

* Restored dashboard datasource variable, and improved error handling in the import api handler

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2019-12-20 11:42:47 +01:00
Dave Henderson
66b70b50b8 Tracing: Support configuring Jaeger client from environment (#21103)
* Tracing: Support configuring Jaeger client from environment
* Tracing: Replace deprecated Jaeger Client call
2019-12-18 20:09:15 +01:00
michael-az
5b3ff90377 Alerting: Add more information to webhook notifications (#20420)
Adds the orgId, dashboardId and panelId of the Webhook alert notifier.
2019-12-18 14:03:59 +01:00
Christoph
8c089b98b3 PagerDuty: Fix custom_details to be a JSON object instead of a string (#21150) 2019-12-18 11:42:25 +02:00
Brian Curtich
cef328d1d6 Cloudwatch ECS Container Insights Support (#21125) 2019-12-17 09:58:24 +02:00
Jerry Ylilammi
e27ab89aed Postgres/MySQL/MSSQL: Adds support for region annotations (#20752)
Adds support for region annotations in Postgres, MySQL and 
MSSQL data sources by adding a column named timeend to 
annotation query.

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

Closes #20918
Ref #10589
2019-12-13 17:25:36 +01:00
Alexander Morozov
06bf7e8ef1 OAuth: Removes send_client_credentials_via_post setting (#20044)
Removes send_client_credentials_via_post oauth setting and 
use auto-detect mechanism instead.
By these changes also fixes statichcheck errors

Ref #8968
2019-12-12 20:00:56 +01:00
Sofia Papagiannaki
b12dc890b8
API: Validate redirect_to cookie has valid (Grafana) url (#21057)
* Restrict redirect_to to valid relative paths

* Add tests
2019-12-12 17:08:34 +02:00
csyangchen
34299a1bd2 Alerting: Fix panic in dingding notifier (#20378)
dingding notifier fails to send alert messages containing JSON, 
This change use map and json.Marshal to always produce valid 
JSON body.

Fixes #9771
2019-12-11 17:01:01 +01:00
Marcus Efraimsson
34236ca1ae
Chore: Improve rendering logging (#21008)
Moving info log from phantomjs to rendering service 
so it's logged for all kinds of renderers.
Add debug log for image renderer plugin and remote 
renderer.
2019-12-11 15:06:59 +01:00
Emil Tullstedt
fe8b533497
Modules: Add patched goavro dependency for extensions (#21027) 2019-12-11 14:44:29 +01:00
Jiajun Huang
5e34e061d5 use https for fetch gravatar by default (#20964) 2019-12-10 08:59:11 +01:00
Paul Traylor
10d36b282b Renderer: Add user-agent to rendering plugin requests (#20956) 2019-12-09 09:11:40 +01:00
Emil Tullstedt
30771f25bf
Revert "Modules: Add goavro dependency for extensions (#20920)" (#20928)
Goavro doesn't compile on 32-bit systems.

This reverts commit 413be3a6a0.
2019-12-06 14:10:07 +01:00