Commit Graph

5292 Commits

Author SHA1 Message Date
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
Emil Tullstedt
413be3a6a0
Modules: Add goavro dependency for extensions (#20920) 2019-12-06 10:33:19 +01:00
Erik Sundell
a533e00622
Remove escaping of \ ( ) characters (#20915) 2019-12-06 09:59:33 +01:00
Arve Knudsen
abc7893fdc
Server: Return 404 when non-pending invite is requested (#20863)
Server API: Return 404 when non-pending invite is requested
2019-12-04 13:01:37 +01:00
Marcus Efraimsson
79c0fa4ca5
CLI: Return error and aborts when plugin file extraction fails (#20849)
Return error and aborts when plugin file extraction fails.
If file is in use, a somewhat user-friendly message is returned.

Fixes #20841
2019-12-04 12:48:40 +01:00
Dima Ryskin
2027e1aaee AlertNotifier: Support alert tags in OpsGenie notifier (#20810)
* support alert tags in OpsGenie notifier

* update readme: OpsGenie alert tags support

* lintfix: remove redundant string formatting
2019-12-03 11:54:37 +01:00
Torkel Ödegaard
87d19787b4
Profile: Remove sign-out tab from profile page (#20802)
* Profile: Remove sign-out tab

* Fixed formatting

* Updated formatting
2019-12-02 18:03:28 +01:00
Arve Knudsen
b1af28122b
Server: Fail when unable to create log directory (#20804) 2019-12-02 15:40:32 +01:00
Sofia Papagiannaki
0b7a5d4ed1
SQLStore: Test admins/editors/viewers stats validity (#20751)
* Test admins/editors/viewers stats validity

*  Use standard testing library instead of Convey
2019-12-02 10:14:20 +02:00
Guangzhe Huang
71792d698b Cleanup: use the local variable (#20767)
Signed-off-by: huanggze <loganhuang@yunify.com>
2019-11-29 07:34:20 -08:00
Sofia Papagiannaki
02d7d00560 SQLStore: Rewrite system statistics query to count users once (#20711)
Fix system statistics query to count only once users that are 
part of several organisations.

Fixes #20681
2019-11-27 18:57:08 +01:00
Arve Knudsen
3c7cfbebe8
Server: Defer wg.Done call to ensure it's called (#20700) 2019-11-27 13:42:15 +01:00
Arve Knudsen
29d27fbaf0
Server: Clean up startup logic/error checking (#20679)
* Server: Clean up startup logic/error checking
2019-11-27 12:07:21 +01:00
Kyle Brandt
4afd40018b
transform: update to use sdk with frame.labels moved to frame.[]field.labels (#20670)
sdk v0.4.0
2019-11-26 13:28:16 -05:00
Sofia Papagiannaki
b16cb92b32 Chore: Improve grafana-server profiling and tracing (#20593)
Profiling and tracing can now be enabled/disabled separately.
Adds argument for trace file path.
Support overriding profiling and tracing argument using 
environment variables.
Update docs.

Fixes #20576
2019-11-25 09:40:10 +01:00
Marcus Efraimsson
3fc5f4552a CloudWatch: Fix high CPU load (#20579)
* Cache decrypted securejsondata
* Models: Add datasource cache tests
2019-11-22 14:21:23 +01:00
Jon Gyllenswärd
bccc5397f6
Instrumentation: Edition and license info to usage stats (#20589)
* Added edition and licensing info to usage stats
2019-11-22 12:19:00 +01:00
Eric Leijonmarck
f05607d4c0 UserTableView: Show user name in table view (#18108)
* refactor to multiple rows

* added name for org user struct

* added name getorgusers

* added user name to tableview

* made test pass

* updated userMocks to user name field

* added missing UsersTable snapshot

* added name on teammembers page, be able to search query for name, login and email

* added the updated snapshots

* conform to same sorting as output form

* conform to previous way of using it

* sort first by login and after by email, as it was before
2019-11-21 12:44:46 +02:00
Sofia Papagiannaki
ea7ccda647
Alerting: Propagate failures to delete dashboard alerts (#20507)
* Propagate failures to delete dashboard alerts
2019-11-21 10:29:51 +02:00
Erik Sundell
359416b89f
Cloudwatch: Fix LaunchTime attribute tag bug (#20237)
* Cast tags of type Time to string

* Fig go lint issue
2019-11-21 09:20:44 +01:00
Marcus Efraimsson
6a4ad136dc
Backend plugins: Log wrapper args formatting fix (#20521)
Formatting fix missed in #20514
2019-11-20 16:57:55 +01:00
Marcus Efraimsson
58b7958952
Backend plugins: Log wrapper args formatting (#20514)
Backend plugins is recommended to use hclog with json 
formatting to get proper log output in grafana server log.
Old hclog-wrapper.go that I deleted while back is still in 
the repo so deletes that.
2019-11-20 14:27:28 +01:00
Erik Sundell
ec18e2bfc3
CloudWatch: Remove HighResolution toggle since it's not being used (#20440)
* Remove highres flag since it's not being used

* Remove not used code. Init id field correctly

* Fix broken tests

* Remove GMS related calculations

* Rename period field

* Add breaking changes to changelog. Also update upgrading docs

* Update snapshot

* Update docs after feedback

* Changes after feedback
2019-11-20 13:34:44 +01:00
Sofia Papagiannaki
d1c523838b
API: Optionally list expired keys (#20468)
* API: Optionally list expired keys

* Update docs
2019-11-20 13:14:57 +02:00
Jon Gyllenswärd
1b38d94537
Image-rendering: Cleanup of rendering code (#20496) 2019-11-20 09:26:59 +01:00
Mitsuhiro Tanda
af35e081c2 handle PartialData status (#20459) 2019-11-19 13:36:32 +01:00
Kyle Brandt
c9309edbb0
transform: changes to support sdk v0.2.0 (#20426)
and update vendor
2019-11-18 11:40:40 -05:00
Jon Gyllenswärd
7a8c6a9b54
Reporting: Handle timeouts in rendering (#20415)
* Added timeout in grpc call to plugins for rendering
2019-11-18 16:58:15 +01:00
Andrej Ocenas
3f144bdd05 Provisioning: Fix unmarshaling nested jsonData values (#20399)
Problem was that yaml unmarshal returned nested maps as
 map[interface{}]interface{} which are then not marshal-able 
to json because of that interface{} key type. This adds explicit 
casting of the keys in the yaml value types to string which 
then makes the values marshal-able to JSON in DB.

Fixes: #11537
2019-11-18 11:06:39 +01:00
Arve Knudsen
82f4fc2783
Fail when server is unable to bind port (#20409)
* Server: Return error when unable to bind port
* Server: Exit if a service fails
* Build: Remove graceful kill from Bra config
2019-11-18 09:49:08 +01:00
Sofia Papagiannaki
886bad2fd5
Util: Modify SplitHostPortDefault not to return an error for empty input (#20351)
* Util: Optionally allow empty input in SplitHostPortDefault

Due to a recent change the SQL Server tests failed because passing an
empty datasource url in `util.SplitHostPortDefault` was no more allowed.
This fix contains the following modifications:
- Modifies the util.SplitHostPortDefault not to return an error for empty input.
- Modifies the util.SplitHostPort to return an error for empty input.
- Introduces an additional test for empty input.
2019-11-18 10:42:51 +02:00
Marcus Efraimsson
dfa2f3d2fb
Chore: Log actual error when oauth pass thru fails (#20419)
Logs the actual error when failing to retreive access token
when OAuth pass true is enabled for a datasource.

Ref: #20407
2019-11-15 17:14:53 +01:00
Emil Tullstedt
d4e013fd44
NavLinks: Make ordering in navigation configurable (#20382)
The ordering of links in the navigation bar is currently based the order of the slice containing the navigation tree. Since Grafana supports adding more links to the navigation bar with `RunIndexDataHooks` which runs at the very end of the function this means that any link registered through a hook will be placed last in the slice and be displayed last in the menu. With this PR the ordering can be specified with a weight which allows for placing links created by extensions in a more intuitive place where applicable.

Stable sorting is used to ensure that the current FIFO ordering is preserved when either no weight is set or two items shares the same weight.
2019-11-15 09:28:55 +01:00
Kyle Brandt
da1df02813
transform_plugin: stop plugin when grafana stops (#20397)
fixes https://github.com/grafana/gel-app/issues/49
until #20362
2019-11-14 15:49:31 -05:00
Sofia Papagiannaki
2ca1cc5645
MySql: Fix password regression in MySQL datasource (#20376) 2019-11-14 12:16:38 +02:00
Erik Sundell
00bef917ee
CloudWatch: Datasource improvements (#20268)
* CloudWatch: Datasource improvements

* Add statistic as template variale

* Add wildcard to list of values

* Template variable intercept dimension key

* Return row specific errors when transformation error occured

* Add meta feedback

* Make it possible to retrieve values without known metrics

* Add curated dashboard for EC2

* Fix broken tests

* Use correct dashboard name

* Display alert in case multi template var is being used for some certain props in the cloudwatch query

* Minor fixes after feedback

* Update dashboard json

* Update snapshot test

* Make sure region default is intercepted in cloudwatch link

* Update dashboards

* Include ec2 dashboard in ds

* Do not include ec2 dashboard in beta1

* Display actual region
2019-11-14 10:59:41 +01:00
Leonard Gram
e9668fd251 LDAP: last org admin can login but wont be removed (#20326)
* LDAP: last org admin (that's going to be removed) can login
Previously, if you tried to login with LDAP but were that last org admin
of an org that you would no longer be an admin of after sync (which
happens at login), you wouldn't be able to login due to an error.
2019-11-13 15:39:15 +01:00
Marcus Efraimsson
5b42bb58f6
Telegram: Check error before adding defer close of image (#20331)
Properly handles file opening error and returns before deferring 
close of file.

Fixes #20156
2019-11-13 13:33:03 +01:00
Marcus Olsson
17724e9f84
Bus: Remove unused wildcard handlers and clean up tests (#20327)
* Refactor bus tests

* Remove wildcard listeners

* Fix review comments
2019-11-13 04:02:44 -08:00
Kyle Brandt
b8029dcd4e
transform_plugin: pass encoded dataframes through (#20333) 2019-11-12 16:21:10 -05:00
Arve Knudsen
3a8cd7b76c Avatar: Don't log failure to add existing item to cache (#19947)
Checks if avatar was found in cache before trying to add it to cache.

Fixes #19946
2019-11-12 18:49:09 +01:00
Shavonn Brown
3e5abe7c21 Admin: Adds setting to disable creating initial admin user (#19505)
Adds a new setting disable_admin_user and when true the default 
admin user will not be created when Grafana starts for the first 
time (or no users exists in the system).

Closes #19038
2019-11-08 11:11:03 +01:00
Jon Gyllenswärd
3111c3620b AuthProxy: additions to ttl config change (#20249)
* fixes according to feedback

* additions to config and docs
2019-11-08 10:51:15 +01:00
Torkel Ödegaard
be2bf1a297
AuthProxy: Can now login with auth proxy and get a login token (#20175)
* AuthProxy: Can now login with auth proxy and get a login token

* added unit tests

* renamed setting and updated docs

* AuthProxy: minor tweak

* Fixed tests and namings

* spellfix

* fix

* remove unused setting, probably from merge conflict

* fix
2019-11-07 17:48:56 +01:00
gotjosh
e4afc8d518 LDAP: Fixing sync issues (#19446)
The arching goal of this commit is to enable single user
synchronisation with LDAP. Also, it included minor fixes of style,
error messages and minor bug fixing.

The changes are:

- bug: The `multildap` package has its own errors when the user is
  not found. We fixed the conditional branch on this error by asserting
on the `multildap` errors as opposed to the `ldap` one

- bug: The previous interface usage of `RevokeAllUserTokens` did not
  work as expected. This replaces the manual injection of the service by
leveraging the service injected as part of the `server` struct.

- chore: Better error messages around not finding the user in LDAP.

- fix: Enable the single sync button and disable it when we receive an
  error from LDAP. Please note, that you can enable it by dispatching
the error. This allows you to try again without having to reload the
page.

- fix: Move the sync info to the top, then move the sync button above
  that information and clearfix to have more harmony with the UI.
2019-11-07 14:31:44 +01:00
stratomonitor
4d7d13175c Alerting: Add alert_state to the kafka message Fixes #11401 (#20099)
* Notifications: Add alert_state to the kafka message Fixes #11401
2019-11-07 14:08:58 +02:00
Jon Gyllenswärd
53f8088316
Auth Proxy: replace ini setting ldap_sync_ttl with sync_ttl (#20191)
* Renamed ttl config in code to be more consistent with behaviour
* Introduced new setting `sync_ttl` in .ini file
* Keeping the old setting `ldap_sync_ttl` in the .ini file as fallback and compatibility.
2019-11-07 11:24:54 +01:00
Jon Gyllenswärd
b489c75aaf
Provisioning: fix for cannot save provisioned dashboard (#20218)
Provisioning of dashboards now always overwrite existing ones and does not look at the configuration `allowUiUpdates` anymore
2019-11-07 10:49:24 +01:00
Torkel Ödegaard
4ffff1a312
LDAP: Interpolate env variable expressions in ldap.toml file (#20173)
* LDAP: Interpolate env variable expressions in ldap.toml file

* Removed comment
2019-11-06 21:41:21 +01:00
Olivier Lemasle
b4712ec4b9 CLI: Reduce memory usage for plugin installation (#19639)
* grafana-cli: use tmp file when downloading plugin install file
2019-11-06 13:42:58 +01:00
Sofia Papagiannaki
19dbd27c5c
mysql: fix encoding in connection string (#20192) 2019-11-06 10:54:53 +02:00
Stephan Eicher
8cf75b4e75 pkg/util: Replace custom pbkdf2 implementation by maintained version (#19941) 2019-11-06 10:03:10 +02:00
Ryan McKinley
92ab4d80f0
Error Handling: support errors and data in a response (#20169) 2019-11-05 15:20:04 -08:00
Martin Reinhardt
7a3d1c0e4b OAuth: Generic OAuth role mapping support (#17149)
Adds support for Generic OAuth role mapping. A new 
configuration setting for generic oauth is added named 
role_attribute_path which accepts a JMESPath expression.
Only Grafana roles named Viewer, Editor or Admin are
accepted.

Closes #9766
2019-11-05 21:56:42 +01:00
Kyle Brandt
17f36d0492
sdk: update to latest (#20182)
which removes an unused field from the Transform api
2019-11-05 14:12:54 -05:00
Jon Gyllenswärd
cce5557145
LDAP: All LDAP servers should be tried even if one of them returns a connection error (#20077)
All ldap servers are now being tried and the first one that gives back an answer is used if a previous one is failing. Applies to login and syncing
2019-11-05 08:58:59 +01:00
Borna Skukan
26f377c433 fix: modifying AWS Kafka dimension names to correct ones (#19986) 2019-11-04 09:33:31 +01:00
Leonard Gram
30775a3f49
Build: adds the pkg/errors dependency that was missing from go.mod (#20143)
This dependency was added a while back and exists in the vendor
directory but was never properly added to go.mod.
2019-11-01 16:54:44 +01:00
Leonard Gram
730bedf36f
LDAP Debug: No longer shows incorrectly matching groups based on role (#20018)
* LDAP Debug: No longer shows incorrectly matching groups based on role

Org Role was used as a shortcut to figure out what groups were matching
and which weren't. That lead to too all groups matching a specific role
to show up for a user if that user got that role.

* LDAP Debug: Fixes ordering of matches

The order of groups in the ldap.toml file is important, only the first
match for an organisation will be used. This means we have to iterate
based on the config and stop matching when a match is found.

We might want to think about showing further matches as potential
matches that are shadowed by the first match. That would possibly make
it easier to understand why one match is used instead of another one.

* LDAP Debug: never display more than one match for the same LDAP group/mapping.

* LDAP Debug: show all matches, even if they aren't used

* Update public/app/features/admin/ldap/LdapUserGroups.tsx

Co-Authored-By: gotjosh <josue.abreu@gmail.com>

* Update public/app/features/admin/ldap/LdapUserGroups.tsx

Co-Authored-By: gotjosh <josue.abreu@gmail.com>
2019-11-01 15:42:22 +01:00
Leonard Gram
992b4b8adf
Licensing service (#19903)
* Licensing: supplies a service to handle licensing information

* Licensing: uses the license service further

Uses the license service instead of settings.isEnterprise:
- external team members
- saml
- usage stats

* Licensing: fixes broken tests due to new Licensing service dependency

* Licensing: fixes linting errors

* Licensing: exposes license expiry information to the frontend
2019-11-01 14:56:12 +01:00
Kyle Brandt
750e8d27bf api/dashboard: fix panic on UI save (#20137) 2019-11-01 07:57:03 +01:00
Ryan McKinley
4d1b969a5c
GEL: include the expression count in the request (#20114) 2019-10-31 16:22:00 -07:00
Jon Gyllenswärd
a45ce36566
Allow saving of provisioned dashboards (#19820)
Allows saving of provisioned dashboards if the config value allowUiUpdates is set to true

Fixes #11778
2019-10-31 14:27:31 +01:00
Marcus Olsson
69906f73a2
Docs: Consolidate backend guidelines (#19823)
* Consolidate backend guidelines

* Fix link

* Fix review comments
2019-10-30 13:59:27 -07:00
Ryan McKinley
861eb72113 transform: add expressions to query editor (w/ feature flag) (#20072)
for use with gel which is not released yet.
2019-10-30 14:38:28 -04:00
Ryan McKinley
2bb4684741
DataSource: don't filter hidden queries automatically (#20088) 2019-10-30 09:51:13 -07:00
Kyle Brandt
009d58c4a2
Plugins: Transform plugin support (#20036)
currently temporary separate http api
2019-10-29 12:22:31 -04:00
Arve Knudsen
f9774acc4c
Enable errcheck for golangci-lint (#19976)
* Enable `errcheck` for golangci-lint
* Fix linting errors
* pkg/plugins: Fix tests
* pkg/plugins: Add test
2019-10-28 17:25:35 +01:00
Marcus Efraimsson
771f21ed09 api: new v2 metrics query endpoint
Requests to endpoint will currently will error unless expressions feature flag is true.

Co-authored-by: Sofia Papagiannaki <papagian@gmail.com>
2019-10-25 09:28:26 -04:00
Sofia Papagiannaki
fc08c26025 WIP: Spawn backend plugins v2 (#19835)
* WIP: Spawn backend plugins v2

* Add test for plugin version

* Fix support for SDK plugins

Co-authored-by: Kyle Brandt <kyle@kbrandt.com>
Co-authored-by: Marcus Olsson <olsson.e.marcus@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* WIP: Draft PR for fork of V2 sdk / bi-directional support (#19890)

* temporary use export-datasource-plugin branch of grafana-plugin-sdk

* fix failing test

* remove debug (spew) lines

* misc cleanup

* add expressions feature toggle

* use latest grafana-plugin-sdk-go
2019-10-24 17:15:27 +02:00
Arve Knudsen
35e0e078b7
pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
Arve Knudsen
9843a886f7
pkg/models: Check errors (#19839)
Check errors in pkg/models.
2019-10-22 16:18:36 +02:00
Arve Knudsen
8ba5509614
pkg/setting: Check errors (#19838)
Check errors in pkg/setting.
2019-10-22 16:17:49 +02:00
Arve Knudsen
bb50fc5965
pkg/tsdb: Check errors (#19837)
Check errors in pkg/tsdb.
2019-10-22 16:16:53 +02:00
Arve Knudsen
2a78d2a61c
pkg/services: Check errors (#19712)
* pkg/services: Check errors
* pkg/services: Don't treat context.Canceled|context.DeadlineExceeded as error
2019-10-22 14:08:18 +02:00
Oleg Utkin
de5038441f API: Fix logging of dynamic listening port (#19644)
Logs the real (dynamic) HTTP port when configured 
Grafana using setting.HttpPort = 0.

Fixes #16709
2019-10-22 13:07:43 +02:00
Nils Diefenbach
7a8f2cd75d Cloudwatch: Lowercase Redshift Dimension entry for service class and stage (#19897)
fixes #19761
2019-10-22 10:33:58 +02:00
Arve Knudsen
31735422ef
pkg/plugins: Only warn if plugins fail to load. Fixes #19846 (#19859)
pkg/plugins: Only warn if plugins fail to load. Fixes #19846
2019-10-18 14:39:38 +02:00
Abhilash Gnan
7f702f881c Alerting: All notification channels should always send (#19807)
Fixes so that all notification channels configured for an alert should 
try to send notification even if one notification channel fails to send
a notification.

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>

Fixes #19768
2019-10-16 09:55:51 +02:00
Arve Knudsen
6e7c18fc1c
pkg/middleware: Check errors (#19749)
* pkg/middleware: Check errors
* pkg/middleware: Log when gzip middleware handler fails
2019-10-15 18:08:06 +02:00
Arve Knudsen
573e78feeb
pkg/cmd: Check errors (#19700)
* pkg/cmd: Check errors
* pkg/cmd: Make sure server waits on services, even in case of error
* pkg/cmd: Inform of error to show help
* pkg/cmd: Only warn on failure to send systemd notification
* pkg/cmd: Don't log errors stemming from context cancelation
* pkg/cmd: Don't fail if unable to write to systemd
2019-10-15 16:44:15 +02:00
Amarnath Karthi
74557a4c40 Dashboard: Allows the d-solo route to be used without slug (#19640)
Allows the d-solo route to be used with UID and without 
a slug.

Fixes #11617
2019-10-14 18:21:44 +02:00
Arve Knudsen
08f01a6c4f
pkg/bus: Check errors (#19748)
* pkg/bus: Check errors
* pkg/bus: Convert tests to testify
2019-10-14 17:23:31 +02:00
Marcus Olsson
428ca600c0
Chore: Refactor grafana-server (#19796)
* Rename GrafanaServerImpl to Server

* Make flag dependencies explicit

* Extract method for building service graph

* Document and clarify methods

* Rename HttpServer to HTTPServer
2019-10-14 14:18:22 +02:00
Arve Knudsen
0b1913af6f
pkg/plugins: Check errors (#19715)
* pkg/plugins: Check errors
2019-10-11 21:02:15 +02:00
Kyle Brandt
2c3c576ca6
fix: export Bus on search service (#19773)
fix pkg/services/search/service.go:52:3: s.bus undefined (type *SearchService has no field or method bus, but does have Bus)

fixes issue introduced by #19765
2019-10-11 11:46:44 -04:00
Marcus Olsson
60f86c3b9c
Chore: Refactor GoConvey into stdlib for search service (#19765)
* Refactor GoConvey into stdlib

* Fix review comments
2019-10-11 17:08:15 +02:00
Weeco
8cd93f0b88 Datasource: Add custom headers on alerting queries (#19508)
* Add custom headers on alerting queries

Reference issue #15381

Signed-off-by: Martin Schneppenheim <martin.schneppenheim@rewe-digital.com>

* Fix datasource transport tests

* Migrate decrypting header test to models pkg

* Check correct header

* Add HTTP transport test

Fixes #15381
2019-10-11 14:28:52 +02:00
Arve Knudsen
7349a6b96c
pkg/infra: Check errors (#19705)
* pkg/infra: Check errors

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

* pkg/infra: Handle errors

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

* Update pkg/infra/usagestats/usage_stats.go

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2019-10-10 16:42:11 +02:00
Arve Knudsen
fe8d0d27d2
pkg/components: Check errors (#19703)
* pkg/components: Check errors
2019-10-10 09:06:55 +02:00
Arve Knudsen
f7ad580356
pkg/login: Check errors (#19714)
* pkg/login: Check errors
* pkg/login: Introduce "login" logger

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2019-10-09 12:57:44 +02:00
Arve Knudsen
b858a5f496
Don't truncate IPv6 addresses (#19573)
* Bugfix: Fix parsing of IPv6 addresses

Make sure that IPv6 addresses aren't truncated when parsing. Fixes #18924
* util: Change network address parsing funcs to return error
* pkg/api: Return NetworkAddress instead of host/port
2019-10-09 08:58:45 +02:00
oddlittlebird
8b064fc141 Docs: Update pkg\README.md (#19615)
* Update README.md

Grammar and spelling edits

* Update pkg/README.md

Co-Authored-By: Marcus Olsson <olsson.e.marcus@gmail.com>

* Update README.md

* Update README.md
2019-10-09 08:04:56 +02:00
Arve Knudsen
0a2d5e16dd
pkg/api: Check errors (#19657)
* pkg/api: Check errors
* pkg/api: Remove unused function HashEmail
2019-10-08 18:57:53 +02:00
Jon Gyllenswärd
606392b4c6 API: added dashboardId and slug in response after import (#19692) 2019-10-08 17:47:18 +02:00
Ben Patterson
9904e14f8e Alerting: Fix dates stored in local time when pausing alerts (#19525)
* Make tests more sensitive to timezone.

* Time stamps should use UTC for consistency.

* Test: Assert state is paused after pauseAllAlerts call.
2019-10-08 17:25:15 +03:00
Anthony Templeton
6c0b5163dd CloudWatch: Changes incorrect dimension wmlid to wlmid (#19679)
Fixes #19476
2019-10-07 23:47:07 +02:00
Chad Nedzlek
20faef8de5 AzureMonitor: Alerting for Azure Application Insights (#19381)
* Convert Azure Application Insights datasource to Go

Allows for alerting of Application Insights data source

Closes: #15153

* Fix timeGrainReset

* Default time interval for querys for alerts

* Fix a few rename related bugs

* Update readme to indicate App Insights alerting

* Fix typo and add tests to ensure migration is happening

* Address code review feedback (mostly typos and unintended changes)
2019-10-07 14:18:14 +02:00
Sriramajeyam
50acb37a17 Azure Monitor : Query more than 10 dimensions ( Fixes #17230 ) (#18693)
* Fixes #17230

* Resovled comments

* Resolved comments

* spell fix
2019-10-03 16:53:11 +02:00
Marcus Olsson
2fb301ccaf
Docs: Improve guides for contributing (#19575)
* Move style guides into contribute directory

* Move contribution guides into contribute directory

* Refactor CONTRIBUTING.md

* Clean up docs/README.md

* Update reference to style guide and minor formatting fixes

* Apply suggestions from code review

Co-Authored-By: gotjosh <josue.abreu@gmail.com>

* Update CONTRIBUTING.md

Co-Authored-By: gotjosh <josue.abreu@gmail.com>
2019-10-03 14:13:58 +02:00
Arve Knudsen
39d8e73412
Chore: Upgrade to Go 1.13 (#19502)
* Chore: Upgrade to Go 1.13

Fixes: #18878

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

* Chore: Upgrade lint tools in order to work with Go 1.13

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

* Chore: Fix Go linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2019-10-02 13:59:05 +02:00
gotjosh
8e508e5ce4 Provisioning: Handle empty nested keys on YAML provisioning datasources (#19547)
* Fix: Handle empty nested keys on YAML provisioning datasources

As we provision a datasource via a YAML file, we attempt to transform the
file into sensible Go types that the provisioning code can use.

While this happens, there is a chance some of the keys nested within
the YAML array are empty.

This fix allows the YAML parser to handle empty keys by null checking
the return of `reflect.TypeOf` which according to the documentation:

> TypeOf returns the reflection Type that represents the dynamic type of i. If i is a nil interface value, TypeOf returns nil.

Can return nil.

* Add tests
2019-10-02 08:48:19 +02:00
Sean Nessworthy
404bf2e0dd CloudWatch: Add ap-east-1 to hard-coded region lists (#19523)
* CloudWatch: Add ap-east-1 to hard-coded region lists (#17448)

* CloudWatch: Fix handleGetRegion tests
2019-10-01 14:23:43 +02:00
gotjosh
4181b30b75
API: Add createdAt and updatedAt to api/users/lookup (#19496)
* API: Add `createdAt` and `updatedAt` to api/users/lookup

In the past, we have added both `updatedAt` (#19004) and `createdAt` (#19475) to /api/users/:id

Turns out, api/users/lookup uses the same DTO for both. This fixes the serialization of both `createdAt` and `updatedAt`for this endpoint.

Also, adds a test to ensure no further regressions.

* Updated API documentation
2019-09-30 20:54:09 +01:00
Andrej Ocenas
3866814ea9
CLI: Fix version selection for plugin install (#19498) 2019-09-30 15:34:09 +02:00
Marcus Efraimsson
93919427f8
Upgrade grafana-plugin-model (#19438)
* use grafana-plugin-model dependency that uses go modules

* use grafana-plugin-model with updated hashicorp/go-plugin

* use grafana-plugin-model with re-compiled protos

* test using protoc-gen-go v1.2.0 tag

* use grafana-plugin-model with re-compiled protos

* chore: fix deprecation warning for lint

* use latest grafana-plugin-model

Fixes #19454
2019-09-30 15:16:04 +02:00
Rafael George
e1b2bf711d API: Add createdAt field to /api/users/:id (#19475)
It would help for auditing purposes to have the user's created date exposed via the API along with the other fields already exposed via the API.
2019-09-28 12:12:33 +01:00
Marcus Efraimsson
00e7c7c4b7
Testdata: Rename package to circumvent convention in go (#19409)
Before this change the tests for test datasource was not run.
2019-09-27 16:18:24 +02:00
Marcus Efraimsson
3de693af49
MySQL: Limit datasource error details returned from the backend (#19373)
Only return certain mysql errors from backend.
The following errors is returned as is from backend:
error code 1064 (parse error)
error code 1054 (bad column/field selected)
error code 1146 (table not exists)
Any other errors is logged and returned as a generic
error.
Restrict use of certain functions:
Do not allow usage of the following in query:
system_user()
session_user()
current_user() or current_user
user()
show grants

Fixes #19360
2019-09-24 20:50:49 +02:00
Erik Sundell
4dbedb8405 Azure Monitor: Revert support for cross resource queries (#19115)" (#19346)
This reverts commit 88051258e9.
2019-09-24 12:01:12 +02:00
Hugo Häggmark
75dcaecc99
Plugins: Skips existence of module.js for renderer plugins (#19318)
* Fix: Skips test for module.js for plugins of renderer type
Fixes #19130

* Refactor: Changes after PR comments

* Chore: Fixes go lint issue
2019-09-23 22:54:28 -07:00
gotjosh
279249ef56
Multi-LDAP: Do not fail-fast on invalid credentials (#19261)
* Multi-LDAP: Do not fail-fast on invalid credentials

When configuring LDAP authentication, it is very common to have multiple
servers configured. When using user bind (authenticating with LDAP using
the same credentials as the user authenticating to Grafana) we don't
expect all the users to be on all LDAP servers.

Because of this use-case, we should not fail-fast when authenticating on
multiple LDAP server configurations. Instead, we should continue to try
the credentials with the next LDAP server configured.

Fixes #19066
2019-09-23 13:34:05 +01:00
Marcus Efraimsson
19f3ec4891
MySQL, Postgres, MSSQL: Only debug log when in development (#19239)
Found some additional debug statements in relation to #19049 that 
can cause memory issues.

Ref #19049
2019-09-20 15:00:28 +02:00
Franco Papalardo
b8334c14f8 CloudWatch: ContainerInsights metrics support (#18971)
* CloudWatch ContainerInsights support
2019-09-20 12:05:58 +03:00
Andrew Rabert
8a991244d5 Alerting: Truncate PagerDuty summary when greater than 1024 characters (#18730)
Requests to PagerDuty fail with an HTTP 400 if the `summary` 
attribute contains more than 1024 characters, this fixes this.
API spec:
https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2

Fixes #18727
2019-09-20 10:39:27 +02:00
Brenda Harjala
c9e566b156 Docs: Minor edits to the README and several md files (#19238)
* Update README.md

Capitalized the G and S in "Getting Started," and moved "guide" to match the section title in the docs.

* Fixed sentence structure. Changed "download" to "grafana.com/get" and changed "get" to "download".

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

*  Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)

* Docs: Replace "datasources" with "data sources" (#19111)
2019-09-20 00:04:56 +02:00
gotjosh
b20a258b72
LDAP: Show non-matched groups returned from LDAP (#19208)
* LDAP: Show all LDAP groups

* Use the returned LDAP groups as the reference when debugging LDAP

We need to use the LDAP groups returned as the main reference for
assuming what we were able to match and what wasn't. Before, we were
using the configured groups in LDAP TOML configuration file.

* s/User name/Username

* Add a title to for the LDAP mapping results

* LDAP: UI Updates to debug view

* LDAP: Make it explicit when we weren't able to match teams
2019-09-19 16:13:38 +01:00
Sofia Papagiannaki
56f5106717
SQL: Rewrite statistics query (#19178)
* Rewrite statistics query
2019-09-19 14:15:26 +03:00
Kevin Printz
79f8433675 Cloudwatch: Fix autocomplete for Gamelift dimensions (#19145) (#19146) 2019-09-19 08:27:15 +02:00
Masudur Rahman
a41a7ea656 Backend: Remove redundant condition of ROLE_VIEWER (#19211) 2019-09-19 08:19:11 +02:00
Marcus Efraimsson
0f524fc947
MSSQL: Revert usage of new connectionstring format (#19203)
This reverts commit 2514209 from #18384. Reason is that it doesn't 
work due to xorm 0.7.1 which doesn't support this new connectionstring 
format.

Fixes #19189
Ref #18384
Ref #17665
2019-09-18 19:30:35 +02:00
Leonard Gram
dd794625dd
API: adds redirect helper to simplify http redirects (#19180) 2019-09-17 19:28:35 +02:00
Erik Sundell
88051258e9
Azure Monitor: Add support for cross resource queries (#19115)
* Add new query mode picker with different states for each query. Also really simple migration script

* Populate cross resource dropdowns

* Cleanup. Handle change events

* Add multi select picker for subscriptions

* Fix markup issue

* Prepare for new query mode

* More cleanup

* Handle multiple queries both in ds and backend

* Refactoring

* Improve migration

* Add support for multiselect display name

* Use multiselect also for locations and resources

* Add more typings

* Fix migrations

* Custom multiselect built for array of options instead of variables

* Add url builder test

* fix datasource tests

* UI fixes

* Improve query editor init

* Fix brokens tests

* Cleanup

* Fix tslint issue

* Change query mode display name

* Make sure alerting works for single queries

* Friendly error for multi resources

* Add temporary typings
2019-09-17 11:35:40 +02:00
Sofia Papagiannaki
b5f0a5d5ca
Api: Readonly datasources should not be created via the API (#19006)
* Readonly datasources should not be created via the API

* Return correct `ReadOnly` value in GetDataSourceByName
2019-09-17 12:29:43 +03:00
Alexander Zobnin
494b4aaf88 LDAP: only show tab if LDAP is enabled (#19156)
* LDAP: add nav link only if ldap enabled

* LDAP: /admin/ldap required admin permissions
2019-09-17 10:27:55 +02:00
Marcus Efraimsson
80592e3361
Metrics: Adds setting for turning off total stats metrics (#19142)
Don't update total stats metrics if reporting is disabled.
New setting disable_total_stats for turning off update 
of total stats (stat_totals_*) metrics.

Ref #19137
2019-09-17 09:32:24 +02:00
Peter Holmberg
3c61b563c3 Ldap: Add LDAP debug page (#18759)
* Add items for navmodel and basic page

* add reducer and actions

* adding user mapping table component

* adding components for ldap tables

* add alert box on error

* close error alert box

* LDAP status page: connect APIs WIP

* LDAP debug: fetch connection status from API

* LDAP debug: fetch user info from API

* LDAP debug: improve connection error view

* LDAP debug: connection error tweaks

* LDAP debug: fix role mapping view

* LDAP debug: role mapping view tweaks

* LDAP debug: add bulk-sync button stub

* LDAP debug: minor refactor

* LDAP debug: show user teams

* LDAP debug: user info refactor

* LDAP debug: initial user page

* LDAP debug: minor refactor, remove unused angular wrapper

* LDAP debug: add sessions to user page

* LDAP debug: tweak user page

* LDAP debug: tweak view for disabled user

* LDAP debug: get sync info from API

* LDAP debug: user sync info

* LDAP debug: sync user button

* LDAP debug: clear error on page load

* LDAP debug: add user last sync info

* LDAP debug: actions refactor

* LDAP debug: roles and teams style tweaks

* Pass showAttributeMapping to LdapUserTeams

* LDAP debug: hide bulk sync button

* LDAP debug: refactor sessions component

* LDAP debug: fix loading user sessions

* LDAP debug: hide sync user button

* LDAP debug: fix fetching unavailable /ldap-sync-status endpoint

* LDAP debug: revert accidentally added fix

* LDAP debug: show error when LDAP is not enabled

* LDAP debug: refactor, move ldap components into ldap/ folder

* LDAP debug: styles refactoring

* LDAP debug: ldap reducer tests

* LDAP debug: ldap user reducer tests

* LDAP debug: fix connection error placement

* Text update

* LdapUser: Minor UI changes moving things around

* AlertBox: Removed icon-on-top as everywhere else it is centered, want to have it be consistent
2019-09-16 18:56:01 +03:00
gotjosh
99c799e9b7
Close the connection only if we establish it. (#18897) 2019-09-16 14:13:35 +01:00
Dominik Prokop
97ff75732d
Routing: Update routing to require sign in on every route (#19118)
* Update routing to require sign in on every route

* Review update
2019-09-16 14:06:50 +02:00
Dominik Prokop
44a2a648c6
Login: fix login page failing when navigating from reset password views (#19124) 2019-09-16 13:38:03 +02:00
Marcus Efraimsson
2acffbeb10
CLI: Fix installing plugins on windows (#19061)
Fixes #19022
2019-09-13 18:12:52 +02:00
gotjosh
7b7b95341e
LDAP: Allow an user to be synchronised against LDAP (#18976)
* LDAP: Allow an user to be synchronised against LDAP
This PR introduces the /ldap/sync/:id endpoint. It allows a user to be synchronized against LDAP on demand.

A few things to note are:

LDAP needs to be enabled for the sync to work
It only works against users that originally authenticated against LDAP
If the user is the Grafana admin and it needs to be disabled - it will not sync the information
Includes a tiny refactor that favours the JSONEq assertion helper instead of manually parsing JSON strings.
2019-09-13 16:26:25 +01:00
Erik Sundell
4c8f417f18 Stackdriver: Add extra alignment period options (#18909)
* Add more alignment period options

* Remove unnecessary alignment period limit
2019-09-13 10:45:59 +02:00
548017
09b434bdd0 Auth: Allow inviting existing users when login form is disabled (#19048)
Allow api to accept inviting existing users when login form is disabled.
UI shows invite button when login form is disabled.
2019-09-12 18:45:50 +02:00
Brian Gann
9eafc693b2
MSSQL: Fix memory leak when debug enabled (#19049)
* fix for #19049
2019-09-12 18:44:31 +02:00
gotjosh
fa007423e3
API: Add updatedAt to api/users/:id (#19004)
* API: Add `updatedAt` to api/users/:id

This adds the timestamp of when a particular user was last updated to
the `api/users/:id` endpoint.

This helps our administrators understand when was the user information last
updated. Particularly when it comes from external systems e.g. LDAP
2019-09-11 13:43:05 +01:00
Kyle Brandt
e5bf3027fc
Refactor: Move sql_engine to sub package of tsdb (#18991)
this way importing the tsdb package does not come with xorm dependencies
2019-09-10 15:50:04 -04:00
Sofia Papagiannaki
7f40dc5317
Image rendering: Add deprecation warning when PhantomJS is used for rendering images (#18933)
* Add deprecation warning

* Update pkg/services/rendering/rendering.go

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2019-09-10 16:16:51 +03:00
lzd
c9c0dd1ea8 Alerting: fix response popover prompt when add notification channels (#18967) 2019-09-09 14:09:21 +02:00
Sofia Papagiannaki
de075e529d
Build: Fix potential case-insensitive import collision for github.com/Unknwon/com (#18915)
* update gopkg.in/macaron.v1

* update github.com/go-macaron/binding

* update github.com/go-macaron/session

* Substitute github.com/Unknwon/com with github.com/unknwon/com

* Clean up modules using `go mod tidy`

* Substitute github.com/Unknwon/bra with github.com/unknwon/bra
2019-09-09 14:22:06 +03:00
Ryan McKinley
7d32caeac2 Transformers: configure result transformations after query(alpha) (#18740) 2019-09-09 08:58:57 +02:00
gotjosh
10fe101add
LDAP: Fetch teams in debug view (#18951)
Adds the definition of `GetTeamsForLDAPGroupCommand` which handles the lookup of team information based on LDAP groupDNs.

This is an Enterprise only feature. To diferentiate,a response will contain the `team` key as `null` on OSS while on Enterprise the key will contain an empty array `[]` when no teams are found.
2019-09-08 11:48:47 +01:00
Sofia Papagiannaki
388d3d3714
Notification is sent when state changes from no_data to ok (#18920) 2019-09-05 18:54:27 +03:00
gotjosh
7c6dd1868b
LDAP: Add API endpoint to query the LDAP server(s) status (#18868)
* LDAP: Add API endpoint to query the LDAP server(s) status|

This endpoint returns the current status(es) of the configured LDAP server(s).

The status of each server is verified by dialling and if no error is returned we assume the server is operational.

This is the last piece I'll produce as an API before moving into #18759 and see the view come to life.
2019-09-04 15:29:14 +01:00
gotjosh
0cbbb43222
LDAP: Add API endpoint to debug user mapping from LDAP (#18833)
* Move the ReloadLDAPCfg function to the debug file

Appears to be a better suite place for this.

* LDAP: Return the server information when we find a specific user

We allow you to specify multiple LDAP servers as part of LDAP authentication integration. As part of searching for specific users, we need to understand from which server they come from. Returning the server configuration as part of the search will help us do two things:

- Understand in which server we found the user
- Have access the groups specified as part of the server configuration

* LDAP: Adds the /api/admin/ldap/:username endpoint

This endpoint returns a user found within the configured LDAP server(s). Moreso, it provides the mapping information for the user to help administrators understand how the users would be created within Grafana based on the current configuration.

No changes are executed or saved to the database, this is all an in-memory representation of how the final result would look like.
2019-09-03 18:34:44 +01:00
Kyle Brandt
364d2358d8
alerting: add lock on job to prevent a race condition (#18218)
without this lock there is a race condition between the scheduler and job processing.
2019-09-03 09:14:28 -04:00
Marcus Efraimsson
964c2e722f
Snapshot: Fix http api (#18830)
(cherry picked from commit be2e2330f5)
2019-09-02 15:15:46 +02:00
Oleg Gaidarenko
1a4be4af8c
Enterprise: add dependencies for upcoming features (#18793)
* Enterprise: add dependencies for upcoming features

See enterprise issues
2019-08-30 18:14:32 +02:00
Gali Alykoff
f942fecc52 Chore: Improve err message for notifications (#18757)
Improve message of notification json error
Fix test after change error message
2019-08-28 16:49:36 +02:00
Marcus Efraimsson
e83f55f394 Chore: Use ruleId instead of alertId as log keyword (#18738) 2019-08-27 08:40:03 +02:00
Bob Shannon
056dbc7012 OAuth: Support JMES path lookup when retrieving user email (#14683)
Add support for fetching e-mail with JMES path

Signed-off-by: Bob Shannon <bobs@dropbox.com>
2019-08-26 18:11:40 +02:00
Oleg Gaidarenko
35b74a99a8
Emails: resurrect template notification (#18686)
* Emails: resurrect template notification

* Phantomjs (oh yeah, there is another dev dep phantom :-) was failing for
  the generation of the html templates so I had to update the dependencies
  in order to fix it. While doing that I update the scripts field and docs
  for it as well. yarn.lock is included

* Move splitting of the emails to separate helper function, since more services
  coming up that would need to use this functionality

* Add support for enterprise specific email letters. Probably could
  be done in the better way, but it's not a priority right now
2019-08-26 17:19:03 +02:00
Oleg Gaidarenko
c5bca40566
Email: add reply-to and direct attachment (#18715)
* Add support for `Reply-To` header

* Allow direct attachment

Don't have tests yet, but they will follow
2019-08-26 16:44:18 +02:00
Ryan McKinley
f7c55d3968 Plugins: better warning when plugins fail to load (#18671)
* better pluin feedback

* add server side check for module.js
2019-08-22 07:04:02 +02:00
Ryan McKinley
e6fbf358c8
TestData: attach labels to series results (#18653) 2019-08-21 07:50:13 -07:00
Oleg Gaidarenko
6ca1a6c8da
Auth: change the error HTTP status codes (#18584)
* Auth: change the error HTTP status codes

* Use 407 HTTP status code for incorrect credentials error

* Improve proxy auth logs

* Remove no longer needed TODO comment

Fixes #18439
2019-08-20 20:13:27 +03:00
Oleg Gaidarenko
02af966964
LDAP: multildap + ldap integration (#18588)
It seems `ldap` module introduced new error type of which
multildap module didn't know about.

This broke the multildap login logic

Fixes #18491
Ref #18587
2019-08-19 00:52:32 +03:00
kay delaney
fb0cec5591
Backend: Adds support for HTTP/2 (#18358)
* Backend: Adds support for HTTP/2

* Adds mozilla recommended ciphers

* Updates sample.ini and config documentation
2019-08-16 16:06:54 +01:00
Ryan McKinley
6335509a23 Annotations: use a single row to represent a region (#17673)
* SQLite migrations

* cleanup

* migrate end times

* switch to update with a query

* real migration

* anno migrations

* remove old docs

* set isRegion from time changes

* use <> for is not

* add comment and fix index decleration

* single validation place

* add test

* fix test

* add upgrading docs

* use AnnotationEvent

* fix import

* remove regionId from typescript
2019-08-16 10:49:30 +02:00
Kyle Brandt
f689b60426
remotecache: support SSL with redis (#18511)
* update go-redis lib from v2 -> v5
* add ssl option to the redis connection string
fixes #18498
2019-08-13 06:51:13 -04:00
Marcus Efraimsson
8fd153edb7
API: Restrict anonymous user information access (#18422)
Existing /api/alert-notifications now requires at least editor access.
Existing /api/alert-notifiers now requires at least editor access.
New /api/alert-notifications/lookup returns less information than
/api/alert-notifications and can be access by any authenticated user.
Existing /api/org/users now requires org admin role.
New /api/org/users/lookup returns less information than
/api/org/users and can be access by users that are org admins,
admin in any folder or admin of any team.
UserPicker component now uses /api/org/users/lookup instead
of /api/org/users.

Fixes #17318
2019-08-12 20:03:48 +02:00
Sofia Papagiannaki
4e29357d15
Backend: Do not set SameSite cookie attribute if cookie_samesite is none (#18462)
* Do not set SameSite login_error cookie attribute if cookie_samesite is none

* Do not set SameSite grafana_session cookie attribute if cookie_samesite is none

* Update middleware tests
2019-08-09 09:10:08 +03:00
Sofia Papagiannaki
7520166f17
API: Minor fix for team creation endpoint when using API key (#18252)
* Fix CreateTeam api endpoint

No team member should be created for requests
authenticated by API tokens.

* Update middleware test

Assert that `isAnonymous` is set for `SignedInUser`
authenticated via API key.

* Add test for team creation

Assert that no team member is created if the signed in user
is anomymous.

* Revert "Fix CreateTeam api endpoint"

This reverts commit 9fcc4e67f5.

* Revert "Update middleware test"

This reverts commit 75f767e58d.

* Fix CreateTeam api endpoint

No team member should be created for requests
authenticated by API tokens.

* Update team test

* Change error to warning and update tests
2019-08-08 11:27:47 +03:00
Alexander Zobnin
b47f0ff07f
OAuth: return GitLab groups as a part of user info (enable team sync) (#18388)
* GitLab OAuth: GetGroups refactor

* GitLab OAuth: fetch groups into UserInfo

* GitLab OAuth: minor refactor

* GitLab OAuth: team sync docs
2019-08-07 17:05:35 +03:00
Kyle Brandt
e1b2d61ceb
backend: null.Float NaN -> null for json marshal (#18284) 2019-08-06 12:28:48 -04:00
Sofia Papagiannaki
269c1fb107
Do not set SameSite for OAuth cookie if cookie_samesite is None (#18392) 2019-08-06 09:50:20 +03:00
Elykov Alexandr
2514209083 MSSQL: Change connectionstring to URL format to fix using passwords with semicolon (#18384)
Fixes #17665
2019-08-05 18:40:33 +02:00
Alexander Berger
4e1e220962 CloudWatch: Fix alerting for queries with Id (using GetMetricData) (#17899)
This commit addresses half of #13749 by making sure GetMetricData 
works for alerting. Math Expressions (compound metrics) will still not 
work for alerting, this would require a bigger refactoring of Grafana's 
alerting service. However, with this commit at least alerting for basic 
metrics with non empty query Id will work.

Fixes half of #13749
2019-08-05 17:28:09 +02:00
Oleg Gaidarenko
d88fdc86fc Auth: Do not search for the user twice (#18366)
* Auth: Do not search for the user twice

Previously `initContextWithBasicAuth` did not use `LoginUserQuery`, doing
`GetUserByLoginQuery` only i.e. looking user in DB only, things changed when
this function started to check LDAP provider via `LoginUserQuery` (#6940),
however, this request was placed after `GetUserByLoginQuery`, so we first
looking in DB then in the LDAP - if LDAP user hasn't logged in we will
not find it in DB, so `LoginUserQuery` will never be reached.

`LoginUserQuery` request already performs `GetUserByLoginQuery`
request in correct sequence. So we can just remove redundant request.

* Correct sequence execution during authentification &
  introduce tests for it

* Move basic auth tests to separate test file, since main test file already
  pretty large

* Introduce `testing.go` for the middleware module

* Remove redundant test helper function

* Make handler names more explicit

Ref 5777f65d05
Fixes #18329

* Auth: address review comment
2019-08-03 21:50:05 +02:00
Dominic Miglar
32d6740b8f Alerting: Also include configured AlertRuleTags in Webhooks (#18233)
* added alert rule tags in webhook notifications

* fix: don't include whole list of Tag objects but only key/value pairs in Webhook JSON

* marked webhook alerts to support alert rule tags
2019-08-03 17:00:40 +02:00
Oleg Gaidarenko
7e89a93b5f
Auth: introduce more tests for middleware module (#18365)
* Add tests for errors basic auth cases and moves tests to separate test-case.
Also names test cases consistently

* Add additional test helper

Ref 82661b9f69
2019-08-02 20:56:58 +03:00
Oleg Gaidarenko
fb273cb874
LDAP: nitpicks (#18309)
* LDAP: nitpicks

* Add more tests

* Correct and clarify comment for Login() method

* Rename methods (hail consistency!)

* Uppercases first letter of the logs everywhere

* Moves method definitions around to more appropriate places

Fixes #18295
2019-08-02 19:24:44 +03:00
Torkel Ödegaard
f3fb178efa Navigation: Fixed double settings menus (#18349) 2019-08-02 14:02:59 +02:00
Oleg Gaidarenko
82661b9f69 Auth: consistently return same basic auth errors (#18310)
* Auth: consistently return same basic auth errors

* Put repeated errors in consts and return only those consts as error strings

* Add tests for errors basic auth cases and moves tests to separate test-case.
  Also names test cases consistently

* Add more error logs and makes their messages consistent

* A bit of code style

* Add additional test helper

* Auth: do not expose even incorrect password

* Auth: address review comments

Use `Debug` for the cases when it's an user error
2019-08-02 11:16:31 +02:00
Leonard Gram
c675449aa2
cli: fix for recognizing when in dev mode. (#18334) 2019-08-02 09:38:41 +02:00
Sofia Papagiannaki
69b7b8bb46 Fix OAuth error due to SameSite cookie policy (#18332)
The `oauth_state` cookie used to be created with the SameSite value set
according to the `cookie_samesite` configuration.
However, due to a Safari bug SameSite=None or SameSite=invalid are treated
as Strict which results in "missing saved state" OAuth login failures
because the cookie is not sent with the redirect requests to the OAuth
provider.
This commit always creates the `oauth_state` cookie with SameSite=Lax
to compensate for this.
2019-08-01 15:47:04 +02:00
gotjosh
ed8aeb2999
Auth Proxy: Include additional headers as part of the cache key (#18298)
* Auth Proxy: Include additional headers as part of the cache key

Auth proxy has support to send additional user attributes as part of the
authentication flow. These attributes (e.g. Groups) need to be monitored
as part of the process in case of change.

This commit changes the way we compute the cache key to include all of the
attributes sent as part of the authentication request. That way, if we
change any user attributes we'll upsert the user information.
2019-07-31 11:23:00 +01:00
Andrej Ocenas
8c49d27705
CLI: Allow installing custom binary plugins (#17551)
Make sure all data is sent to API to be able to select correct archive version.
2019-07-29 10:44:58 +02:00
gotjosh
2f240a11ce SAML: Only show SAML login button on Enterprise version (#18270)
SAML Authentication is an Enterprise only feature. This change enables
the SAML login button to only be shown on enterprise.
2019-07-26 11:05:02 +02:00
Andrej Ocenas
7f1214ac46
Permissions: Show plugins in nav for non admin users but hide plugin configuration (#18234)
Allow non admins to see plugins list but only with readme. Any config tabs are hidden from the plugin page. Also plugin panel does not show action buttons (like Enable) for non admins.
2019-07-25 16:54:26 +02:00
Oleg Gaidarenko
1e5fc76601
LDAP: improve POSIX support (#18235)
* LDAP: improve POSIX support

* Correctly abtain DN attributes result

* Allow more flexibility with comparison mapping between POSIX group & user

* Add devenv for POSIX LDAP server

* Correct the docs

Fixes #18140
2019-07-24 12:49:18 +03:00
Dima Kurguzov
a4b0ccc138 Instrumentation: Add failed notifications metric (#18089) 2019-07-24 11:43:24 +02:00