Commit Graph

5292 Commits

Author SHA1 Message Date
Markus Blaschke
31547597d3 remote_cache: Fix redis connstr parsing (#18204)
* Fix redis connstr parsing

* Don’t log the password
2019-07-23 16:45:04 +03:00
Oleg Gaidarenko
d16fd58bdb
Auth: do not expose disabled user disabled status (#18229)
Fixes #17947
2019-07-23 13:12:55 +03:00
Kyle Brandt
ea0cee4c35
alerting: more specific error when missing threshold (#18221)
fixes #18184
2019-07-22 13:23:33 -04:00
Kyle Brandt
172464e91e
alerting: return err when SetAlertState fails to save to sql (#18216)
fix duplicate alert states when the alert fails to save to the database.
fixes #18176
2019-07-22 07:23:27 -04:00
Leonard Gram
2014549fa5 PhantomJS: Fixes rendering on Debian Buster (#18162)
Closes #17588
2019-07-20 13:03:10 +02:00
Raphael Couto
bc0da1bbfc Plugin: AzureMonitor - Reapply MetricNamespace support (#17282)
* Reapply MetricNamespace support

* Fixing tests

* refactor: move metricnamespace param to backend

* refactor: remove unused function

* azuremonitor: migration for new metric namespace field

* azuremonitor: add template query for metric namespace with a sub

* docs: template queries for azure monitor

Adds new lines for the metricnamespace template function and fixes
some messed up lines
2019-07-20 01:43:52 +02:00
Alexander Zobnin
ccf11fb7a2
SAML: add auth provider label (#18197) 2019-07-19 17:13:29 +03:00
Ryan McKinley
0ca1e90b2e
Plugins: fix previous commit, output "build" property in json 2019-07-19 06:21:39 -07:00
Alexander Zobnin
214195441f
SAML: add metrics (#18194) 2019-07-19 15:30:31 +03:00
Ryan McKinley
3e0625ff3d
Plugins: add build info to plugin metadata (#18164) 2019-07-18 11:52:34 -07:00
Kyle Brandt
7cac393ddc
datasource: testdata - add predicatable csv wave scenario (#18183) 2019-07-18 13:36:22 -04:00
Kyle Brandt
ed099d5ca0
datasource: testdata - add predictable pulse scenario (#18142)
Adds pulse waveform. Is predictable in the sense that the start of the waveform is aligned to epoch time (instead of the start of the query time). This makes a useful signal for manual testing of alerting in the devenv.
2019-07-17 15:48:08 -04:00
Oleg Gaidarenko
d9f01cb822
SQLStore: use bool pointer instead of string (#18111) 2019-07-17 06:24:56 +03:00
Oleg Gaidarenko
75fa1f0207 Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics

Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?

* Metrics: make the naming consistent

* Metrics: add comments to exported vars

* Metrics: use proper naming

Fixes #18110
2019-07-16 16:58:46 +02:00
Oleg Gaidarenko
8e0f091f14
SQLStore: allow to look for is_disabled flag (#18032)
* Add support for `is_disabled` to `CreateUser()`

* Add support for `is_disabled` to `SearchUsers()`
  Had to add it as a `string` type not as `bool`, since if that's property
  is omitted, we would have add it to SQL request, which might be dangerous

* Restructure desctructive tests and add more
2019-07-15 09:14:32 +03:00
Oleg Gaidarenko
09eb9a45ce
Metrics: add LDAP active sync summary metric (#18079) 2019-07-15 08:33:48 +03:00
Kyle Brandt
76d08989f0
provisioning: escape literal '$' with '$$' to avoid interpolation (#18045)
fixes #17986
2019-07-11 07:32:07 -04:00
Anthony Templeton
3680b95b44 Auth: Duplicate API Key Name Handle With Useful HTTP Code (#17905)
* API: Duplicate API Key Name Handle With Useful HTTP Code

* 17447: make changes requested during review

- use dialect.IsUniqueContraintViolation
- change if statement to match others
- return error properly

* Revert "17447: make changes requested during review"

This reverts commit a4a674ea83.

* API: useful http code on duplicate api key error w/ tests

* API: API Key Duplicate Handling

fixed small typo associated with error
2019-07-11 11:20:34 +03:00
Sofia Papagiannaki
f2ad3242be
API: Minor fix for nil pointer when trying to log error during creating new dashboard via the API (#18003)
* Minor fix for nil pointer when trying to log error

* Do not return error if a dashboard is created

Only log the failures

* Do not return error if the folder is created

Only log the failures
2019-07-11 09:45:29 +03:00
Marcus Efraimsson
6a3a2f5f94
CLI: Fix encrypt-datasource-passwords fails with sql error (#18014)
Now handles secure_json_data stored as null in database when
running the encrypt-datasource-passwords migration.

Fixes #17948
2019-07-10 12:28:40 +02:00
Leonard Gram
5d3a60d46e
LDAP: Adds bind before searching LDAP for non-login cases. (#18023) 2019-07-10 12:25:21 +02:00
Alexander Zobnin
5f0a7f43c3
Users: show badges for each auth provider (#17869)
* Users: show badges for each auth provider

* Chore: don't use functions in angular bindings

* Users: minor style changes to labels

* Chore: convert auth labels on the backed side, deduplicate frontend code

* Users: use authLabels everywhere instead of authModule

* User: fix edit user page style

* Users: minor fixes after review
2019-07-10 12:06:51 +03:00
Ryan McKinley
81ff856568
grafana-cli: allow installing plugins from a local zip file (#18021) 2019-07-10 00:40:33 -07:00
Leonard Gram
25506829be
LDAP: Adds back support for single bind. (#17999) 2019-07-09 14:12:17 +02:00
gotjosh
332920954e
SAML: Show SAML login button even if OAuth is disabled (#17993)
* Move the SAML button outside of the oauth div
* Don't attempt to search cookies with an empty name
2019-07-09 10:15:52 +01:00
Sofia Papagiannaki
78ca55f3d7
Fix: Break redirect loop if oauth_auto_login = true and OAuth login fails (#17974)
* Add tests for login view

* Fix OAuth auto login redirect loop

login_error cookie is only set when the OAuth login fails
for some reason. Therefore, the login view should return
immediately if a login_error cookie exists before trying
to login the user using OAuth again.

* Fix test

Use 'index-template' instead of 'index' for testing

* Add some comments
2019-07-09 09:37:24 +03:00
Marcus Efraimsson
962d4daabd
Api: Fix auth tokens returning wrong seenAt value (#17980)
Changes so a non-set seenAt property gets the createdAt value.

Fixes #17953
2019-07-08 14:30:02 +02:00
Oleg Gaidarenko
e2cf7c9698
LDAP: finishing touches (#17945)
* LDAP:Docs: `active_sync_enabled` setting

Mention `active_sync_enabled` setting and enable it by default

* LDAP: move "disableExternalUser" method

Idea behind new design of the LDAP module is to minimise conflation
between other parts of the system, so it would decoupled as much as
possible from stuff like database, HTTP transport and etc.

Following "Do One Thing and Do It Well" Unix philosophy principal, other things
could be better fitted on the consumer side of things.

Which what this commit trying to archive

* LDAP: correct user/admin binding

The second binding was not happening, so if the admin login/password
in LDAP configuration was correct, anyone could had login as anyone using
incorrect password
2019-07-05 17:49:00 +03:00
Leonard Gram
b67905a963
Auth: saml enabled check. (#17960) 2019-07-05 16:39:52 +02:00
Leonard Gram
e574147b1e Auth: SAML login button. (#17932)
* Auth: SAML login button.

* Fixed ts issue
2019-07-05 15:24:52 +02:00
gotjosh
e6b8a1529b
SAML: Configuration defaults, examples and dependencies (#17954)
* Add SAML configuration options

* Add crewjam/saml as a depdency

Needed as part of the enterprise SAML integration.

* Vendor github.com/stretchr/testify/require

The package require implements the same assertions as the `assert` package but stops test execution when a test fails.
2019-07-05 11:27:14 +01:00
Alexander Zobnin
48d5a1bcd3 OAuth: deny login for disabled users (#17957) 2019-07-05 11:35:04 +02:00
Daniel Lee
7e95ded164
AzureMonitor: remove duplicate query logic on the frontend (#17198)
* feat: AzureMonitor implements legend key on backend

To be able to remove the duplicated query logic on the
frontend, the backend code needs to implement alias
patterns for legend keys as well as allowing the default
list of allowed time grains to be overridden. Some metrics
do not support all the time grains and the auto timegrain
calculation can be incorrect if the list is not overridden.

* feat: AzureMonitor - removes duplicate query logic on frontend

* AzureMonitor small refactoring

Extracted method and tidied up the auto time grain
code.

* azuremonitor: support for auto time grains for alerting

Converts allowed timegrains into ms and saves in dashboard json.
This makes queries for alerting with an auto time grain work in
the same way as the frontend.

* chore: typings -> implicitAny count down to 3413

* azuremonitor: add more typings
2019-07-04 22:47:24 +02:00
Oleg Gaidarenko
444c4d5999
LDAP: Divide the requests (#17885)
* LDAP: Divide the requests

Active Directory does indeed have a limitation with 1000 results
per search (default of course).

However, that limitation can be workaround with the pagination search feature,
meaning `pagination` number is how many times LDAP compatible server will be
requested by the client with specified amount of users (like 1000). That feature
already embeded with LDAP compatible client (including our `go-ldap`).

But slapd server has by default stricter settings. First, limitation is not 1000
but 500, second, pagination workaround presumably (information about it a bit
scarce and I still not sure on some of the details from my own testing)
cannot be workaround with pagination feature.

See
https://www.openldap.org/doc/admin24/limits.html
https://serverfault.com/questions/328671/paging-using-ldapsearch
hashicorp/vault#4162 - not sure why they were hitting the limit in
the first place, since `go-ldap` doesn't have one by default.

But, given all that, for me `ldapsearch` command with same request
as with `go-ldap` still returns more then 500 results, it can even return
as much as 10500 items (probably more).

So either there is some differences with implementation of the LDAP search
between `go-ldap` module and `ldapsearch` or I am missing a step :/.

In the wild (see serverfault link), apparently, people still hitting that
limitation even with `ldapsearch`, so it still seems to be an issue.

But, nevertheless, I'm still confused by this incoherence.

To workaround it, I divide the request by no more then
500 items per search
2019-07-03 17:39:54 +03:00
Alexander Zobnin
3d848d0fdf
Teams: show proper label for each auth provider (#17860)
* Teams: show proper label for each auth provider

Teams: don't sore AuthModule in team_member table, use JOIN to get it instead

* Teams: fix AddTeamMember after last changes

* Teams: add more auth provider labels

* Teams: show external sync badge if LDAP is not enabled

* Teams: tests for getting auth module
2019-07-03 16:52:10 +03:00
Anthony Templeton
0d2be0a7ed Logging: Login and Logout logging actions (#17760) (#17883) 2019-07-03 15:16:00 +02:00
Sofia Papagiannaki
2ae6adef26
Codestyle: add guidelines for removing the m alias for models (#17890)
* Add guidelines for avoiding use of m alias for models

* Add suggestion for elimination of existing aliases
2019-07-03 11:36:01 +03:00
Oleg Gaidarenko
caa1314f44
Build: use golangci-lint as a make command (#17739)
* Build: use golangci-lint as a make command

* Since gometalinter was deprecated in favor of golangci-lint so it was
  replaced by it. Responsibilities held by the gometalinter was moved to
  golangci-lint

* There was some changes in implementation (that was also mentioned in
  the code comment) between the tools, which uncovered couple errors
  in the code. Those issues were either solved or disabled by
  the inline comments

* Introduce the golangci-lint config, to make their
  configuration more manageable

* Build: replace backend-lint.sh script with make
2019-07-02 16:06:59 +03:00
Leonard Gram
8f150c67aa
Docs upgrading deps (#17657)
* Docs: correct link to the Grafana build-container.

* Docs: documents usage on the gopath when upgrading deps.

* Dev docs: info for upgrading deps only in one location.
2019-07-02 09:43:25 +02:00
Leonard Gram
d71043609e
Testing: Include BatchRevoke for all tokens in the fake. (#17728) 2019-07-02 09:42:35 +02:00
Oleg Gaidarenko
ca136c7c22
Devenv:LDAP: couple simplifications for LDAP (#17807)
* Add LDAP config instead sed use

* Add container name

* Add SizeLimit option to client and to server.
  Probably useless at this point, but it's better to have it then otherwise
2019-07-01 15:09:04 +03:00
Oleg Gaidarenko
5836427794
Login: divide login errors by pkg and service (#17835)
Define errors in the login module only if they are used
2019-07-01 14:32:17 +03:00
Sofia Papagiannaki
f3f03ceb6a
Auth Proxy: Respect auto_sign_up setting (#17843)
* Add test for disabled auth proxy auto signup option

* Set correctly auth proxy auto signup
2019-07-01 14:29:41 +03:00
Alexander Zobnin
c2affdee1e
OAuth: return github teams as a part of user info (enable team sync) (#17797)
* OAuth: github team sync POC

* OAuth: minor refactor of github module

* OAuth: able to use team shorthands for github team sync

* support passing a list of groups via auth-proxy header
2019-07-01 12:30:17 +03:00
Marcus Efraimsson
0a3f977ea2
Usage Stats: Update known datasource plugins (#17787) 2019-06-26 21:15:45 +02:00
Sofia Papagiannaki
dc9ec7dc91
Auth: Allow expiration of API keys (#17678)
* Modify backend to allow expiration of API Keys

* Add middleware test for expired api keys

* Modify frontend to enable expiration of API Keys

* Fix frontend tests

* Fix migration and add index for `expires` field

* Add api key tests for database access

* Substitude time.Now() by a mock for test usage

* Front-end modifications

* Change input label to `Time to live`
* Change input behavior to comply with the other similar
* Add tooltip

* Modify AddApiKey api call response

Expiration should be *time.Time instead of string

* Present expiration date in the selected timezone

* Use kbn for transforming intervals to seconds

* Use `assert` library for tests

* Frontend fixes

Add checks for empty/undefined/null values

* Change expires column from datetime to integer

* Restrict api key duration input

It should be interval not number

* AddApiKey must complain if SecondsToLive is negative

* Declare ErrInvalidApiKeyExpiration

* Move configuration to auth section

* Update docs

* Eliminate alias for models in modified files

* Omit expiration from api response if empty

* Eliminate Goconvey from test file

* Fix test

Do not sleep, use mocked timeNow() instead

* Remove index for expires from api_key table

The index should be anyway on both org_id and expires fields.
However this commit eliminates completely the index for now
since not many rows are expected to be in this table.

* Use getTimeZone function

* Minor change in api key listing

The frontend should display a message instead of empty string
if the key does not expire.
2019-06-26 09:47:03 +03:00
Alexander Zobnin
dad894f1cc
API: get list of users with additional auth info (#17305)
* batch disable users

* batch revoke users tokens

* split batch disable user and revoke token

* API: get users with auth info and isExternal flag

* fix tests for batch disable users

* Users: refactor /api/users/search endpoint

* Users: use alias for "user" table

* Chore: add BatchDisableUsers() to the bus

* Users: order user list by id explicitly

* Users: return AuthModule from /api/users/:id endpoint

* Users: do not return unused fields

* Users: fix SearchUsers method after last changes

* User: return auth module as array for future purposes

* User: tests for SearchUsers()

* User: return only latest auth module in SearchUsers()

* User: fix JOIN, get only most recent auth module
2019-06-25 18:29:07 +03:00
Marcus Efraimsson
5713048f48
Alerting: Improve alert rule testing (#16286)
* tsdb: add support for setting debug flag of tsdb query

* alerting: adds debug flag in eval context

Debug flag is set when testing an alert rule and this debug
flag is used to return more debug information in test aler rule
response. This debug flag is also provided to tsdb queries so
datasources can optionally add support for returning additional
debug data

* alerting: improve test alert rule ui

Adds buttons for expand/collapse json and copy json to clipboard,
very similar to how the query inspector works.

* elasticsearch: implement support for tsdb query debug flag

* elasticsearch: embedding client response in struct

* alerting: return proper query model when testing rule
2019-06-25 08:52:17 +02:00
Marcus Efraimsson
eecd8d1064 Elasticsearch: Visualize logs in Explore (#17605)
* explore: try to use existing mode when switching datasource

* elasticsearch: initial explore logs support

* Elasticsearch: Adds ElasticsearchOptions type
Updates tests accordingly

* Elasticsearch: Adds typing to query method

* Elasticsearch: Makes maxConcurrentShardRequests optional

* Explore: Allows empty query for elasticsearch datasource

* Elasticsearch: Unifies ElasticsearchQuery interface definition
Removes check for context === 'explore'

* Elasticsearch: Removes context property from ElasticsearchQuery interface
Adds field property
Removes metricAggs property
Adds typing to metrics property

* Elasticsearch: Runs default 'empty' query when 'clear all' button is pressed

* Elasticsearch: Removes index property from ElasticsearchOptions interface

* Elasticsearch: Removes commented code from ElasticsearchQueryField.tsx

* Elasticsearch: Adds comment warning usage of for...in to elastic_response.ts

* Elasticsearch: adds tests related to log queries
2019-06-24 21:15:03 +01:00
gotjosh
2fb45eeec8
Grafana-CLI: Wrapper for grafana-cli within RPM/DEB packages and config/homepath are now global flags (#17695)
* Feature: Introduce a grafana-cli wrapper

When our users install the *nix packed version of grafana, tendency is to use the services and scripts installed as part of the package for grafana-server. These leverage the default configuration options by specifying the several default paths.

This introduces a similar approach for the grafana-cli binary. We exposed it through a wrapper to ensure a proper configuration is in place. To enable that, we add the .real suffix to the original binary (grafana-cli.real) and then use a bash script named grafana-cli as the wrapper.

* Make the config and homepath flags global

* Introduce `configOverrides` as a global flag

This flag allows us to pass configuration overrides as a string.

The string follows the convention of configuration arguments separated by a space e.g. "cfg:default.paths.data=/dev/nullX cfg:default.paths.logs=/dev/nullX"

Also, it is backwards compatible with similar the previous configuration method through tailing arguments. Tailing arguments take presedence over the configuration options string.

* Only log configuration information in debug mode

* Move the grafana-cli binary to $GRAFANA_HOME/bin

As part of the package install process, we copy all the release files and
directories into the grafana home directory. This includes the /bin folder
from where we copied the binaries into their respective destinations.
After that, the /bin folder gets deleted as we don't want to keep
duplicates of the binaries around.

As part of this commit, we moved the re-creation of /bin within
grafana-home and the copy of the original binary (again) after the
folder gets deleted.
2019-06-24 20:20:21 +01:00
Sofia Papagiannaki
e7e9d3619e
Add guidelines for SQL date comparisons (#17732) 2019-06-24 20:39:28 +03:00
Leonard Gram
4c97d26102 Docs: clarified usage of go get and go mod (#17637) 2019-06-24 18:29:57 +02:00
Kyle Brandt
0adbb001db RemoteCache: redis connection string parsing test (#17702) 2019-06-24 11:51:38 +02:00
Sofia Papagiannaki
d0852f0618
Fix link in pkg/README (#17714)
Remove leading backslash from url
2019-06-24 10:34:51 +03:00
Kyle Brandt
49f0f0e89e
config: fix connstr for remote_cache (#17675)
fixes #17643 and adds test to check for commented out lines (but will only catch `;`, not `#`).
2019-06-20 10:15:21 -04:00
Oleg Gaidarenko
1c08e58605
LDAP: small improvements to various LDAP parts (#17662)
* Add multildap config example

* Publicize mocks for multildap module
2019-06-19 15:46:04 +02:00
Kyle Brandt
bd08d8ce8e
middleware: fix Strict-Transport-Security header (#17644)
fixes #17641
2019-06-18 14:24:23 -04:00
gotjosh
7d68d6ede2
grafana-cli: Fix receiving flags via command line (#17617)
`grafana-cli` uses the third-party library to define the flags and not
the standard library. Using `flag.Parse` conflicts with the defined
flags from our third-party library.

In the case where `flag.Parse` is used, the CLI assumes that definitions
provided are not needed and will not define them; producing errors of
the kind `flag provided but not defined --example-flag`.

Using the context to read any arguments (including flags) is the
recommended approach by the third-party library.
2019-06-18 10:25:37 +01:00
Carl Bergquist
b98bb48d59
codestyle: styleguide and arch for grafanas backend (#17545) 2019-06-18 09:31:51 +02:00
Yann Verry
ed613194ac HTTPServer: Fix X-XSS-Protection header formatting (#17620)
Fixes #17619
2019-06-17 23:46:35 +02:00
gotjosh
6fbca90269
cli: grafana-cli should receive flags from the command line (#17606)
grafana-cli should allow configuration overrides to be received from the command line. e.g.

```
grafana-cli admin reset-password cfg:default.paths.logs=custom/log/directory/
```

Seems like we missed the inclusion of `flag.Parse` as we run the command,  to be able to consume them.

Additionally, it'll be useful for the user to know whenever these are being overriden or not - hence the addition of logging the configuration to be used as we run the command.
2019-06-17 11:27:26 +01:00
Oleg Gaidarenko
c853ef7318
SQLStore: extend user.SearchUsers method (#17514)
* SQLStore: extend `user.SearchUsers` method

Allow `user.SearchUsers` to search users based on their auth type
2019-06-14 09:50:38 +01:00
Leonard Gram
37e9988e95
ldap: makes mocks available for testing. (#17576)
* ldap: makes mocks available for testing.
2019-06-14 09:54:19 +02:00
Oleg Gaidarenko
1b1d951495 LDAP: refactoring (#17479)
* LDAP: use only one struct

* Use only models.ExternalUserInfo

* Add additional helper method :/

* Move all the helpers to one module

* LDAP: refactoring

* Rename some of the public methods and change their behaviour

* Remove outdated methods

* Simplify logic

* More tests
  There is no and never were tests for settings.go, added tests for helper
  methods (cover is now about 100% for them). Added tests for the main
  LDAP logic, but there is some stuff to add. Dial() is not tested and not
  decoupled. It might be a challenge to do it properly

* Restructure tests:
   * they wouldn't depend on external modules
   * more consistent naming
   * logical division

* More guards for erroneous paths

* Login: make login service an explicit dependency

* LDAP: remove no longer needed test helper fns

* LDAP: remove useless import

* LDAP: Use new interface in multildap module

* LDAP: corrections for the groups of multiple users

* In case there is several users their groups weren't detected correctly

* Simplify helpers module
2019-06-13 16:47:51 +02:00
Sofia Papagiannaki
7b70e7db2d
AuthProxy: Optimistic lock pattern for remote cache Set (#17485)
* Implementation of optimistic lock pattern

Try to insert the remote cache key and handle integrity error

* Remove transaction

Integrity error inside a transaction results in deadlock

* Remove check for existing remote cache key

Is no longer needed since integrity constrain violations are handled

* Add check for integrity constrain violation

Do not update the row if the insert statement fails
for other than an integrity constrain violation

* Handle failing inserts because of deadlocks

If the insert statement fails because of a deadlock
try to update the row

* Add utility function for returning SQL error code

Useful for debugging

* Add logging for failing expired cache key deletion

Do not shallow it completely

* Revert "Add utility function for returning SQL error code"

This reverts commit 8e0b82c79633e7d8bc350823cbbab2ac7a58c0a5.

* Better log for failing deletion of expired cache key

* Add some comments

* Remove check for existing cache key

Attempt to insert the key without checking if it's already there
and handle the error situations

* Do not propagate deadlocks created during update

Most probably somebody else is trying to insert/update
the key at the same time so it is safe enough to ignore it
2019-06-13 15:36:09 +02:00
Marcus Efraimsson
e1df51109e
Fix so that correct cache is provided to di registry (#17566)
This fix prevents Grafana from crashing after being logged in.

Ref #17519
2019-06-13 12:15:52 +02:00
Carl Bergquist
6809d2bb29
codestyle: moves cache to infra (#17519) 2019-06-13 10:55:38 +02:00
Maxim Ivanov
151fe240fc OAuth: Fix for wrong user token updated on OAuth refresh in DS proxy (#17541) 2019-06-12 13:47:38 +02:00
Kyle Brandt
599514ad68
middleware: add security related HTTP(S) response headers (#17522)
* x_xss_protection
  * strict_transport_security (HSTS)
  * x_content_type_options

these are currently defaulted to false (off) until the next minor release.

fixes #17509
2019-06-12 13:15:50 +02:00
Mario Trangoni
ab4e1526b3 Codestyle: Fix some goconst issues (#17530)
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-06-12 07:27:47 +02:00
Shavonn Brown
a20309d7d2
Feature: Parse user agent string in user auth token api response (#16… (#17504)
* Feature: Parse user agent string in user auth token api response (#16222)

* Adding UA Parser Go modules attempt (#16222)

* Bring user agent vals up per req

* fix tests

* doc update

* update to flatten, no maps

* update doc
2019-06-11 14:12:52 +02:00
Kyle Brandt
c09fe3c3b4
remote_cache: Fix redis (#17483)
* wip: fix remote cache for redis
connstr parsing and non-negative expires for #17377
TODO: finish parse, check zero case, find out why negative duration in the first place

* finish parse.
Still TODO, find out negative value, and decide if would be better to make database specific entries in the .ini file

* update ini files

* remove accidental uncomment in defaults.ini

* auth_proxy: expiration non-negative so expiration is not in the past

* fix test, revert neg in redis

* review: use errutil
2019-06-10 15:27:08 +02:00
Kyle Brandt
826d33ea37
auth_proxy: non-negative cache TTL (#17495)
fixes setex error with redis on #17377
2019-06-10 15:25:23 +02:00
Kyle Brandt
a95c7bfa6f
sqlstore: clean quota and user_auth_tokens when removing users (#17487)
fixes #17392
2019-06-10 13:35:47 +02:00
Oleg Kovalov
6a76a92aff Prometheus: Preallocate data for Prometheus backend response parsing (#17490) 2019-06-10 08:12:46 +02:00
Carl Bergquist
912df2e284
gtime: some code style refactoring (#17369) 2019-06-10 07:38:31 +02:00
Oleg Gaidarenko
2316414786
Add tests for multildap (#17358)
That should get us to 100% coverage
2019-06-07 15:16:00 +03:00
Carl Bergquist
1aadb4426a
metrics: expose stats about roles as metrics (#17469) 2019-06-06 16:39:35 +02:00
Thibault Chataigner
e06abb30aa Alerting: Add tags to alert rules (#10989)
Ref #6552
2019-06-06 13:29:30 +02:00
Jonathan Rockway
02975256d1 Tracing: allow propagation with Zipkin headers (#17009)
Closes #17006
2019-06-05 13:12:05 +02:00
Andrej Ocenas
1c3ad78672
Perf: Fix slow dashboards ACL query (#17427)
Fix slow ACL query for dashboards that was used as subquery on multiple places slowing down search and login in instances with many dashboards.
2019-06-05 10:55:50 +02:00
Utkarsh Bhatnagar
a9da7b5f1f Cloudwatch: Add AWS DocDB metrics (#17241)
Closes #16535
2019-06-05 08:49:48 +02:00
Augustin Husson
c8382ba435 Provisioning: Support folder that doesn't exist yet in dashboard provisioning (#17407)
closes #17320
2019-06-04 22:23:08 +02:00
Mario Trangoni
87760d4fde Codestyle: Fix govet issues (#17178)
ref #10381

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-06-04 22:00:05 +02:00
Marcus Efraimsson
b7a9533476
Database: Initialize xorm with an empty schema for postgres (#17357)
xorm introduced some changes in
https://github.com/go-xorm/xorm/pull/824 and
https://github.com/go-xorm/xorm/pull/876 which by default will use
public as the postgres schema and this was a breaking change compared
to before. Grafana has implemented a custom postgres dialect so above
changes wasn't a problem here. However, Grafana's custom database
migration was using xorm dialect to check if the migration table exists
or not.
For those using a custom search_path (schema) in postgres configured on
server, database or user level the migration table check would not find
the migration table since it was looking in public schema due to xorm
changes above. This had the consequence that Grafana's database
migration failed the second time since migration had already run
migrations in another schema.
This change will make xorm use an empty default schema for postgres and
by that mimic the functionality of how it was functioning before
xorm's changes above.
Fixes #16720

Co-Authored-By: Carl Bergquist <carl@grafana.com>
2019-06-03 16:45:03 +02:00
Hugo Häggmark
fb39831df2
Explore: Queries the datasource once per run query and uses DataStreamObserver (#17263)
* Refactor: Removes replaceUrl from actions

* Refactor: Moves saveState thunk to epic

* Refactor: Moves thunks to epics

* Wip: removes resulttype and queries once

* Refactor: LiveTailing uses observer in query

* Refactor: Creates epics folder for epics and move back actioncreators

* Tests: Adds tests for epics and reducer

* Fix: Checks for undefined as well

* Refactor: Cleans up previous live tailing implementation

* Chore: merge with master

* Fix: Fixes url issuses and prom graph in Panels

* Refactor: Removes supportsStreaming and adds sockets to DataSourcePluginMeta instead

* Refactor: Changes the way we create TimeSeries

* Refactor: Renames sockets to streaming

* Refactor: Changes the way Explore does incremental updates

* Refactor: Removes unused method

* Refactor: Adds back Loading indication
2019-06-03 14:54:32 +02:00
Carl Bergquist
d8736a2547
Alerting: golint fixes for alerting (#17246) 2019-06-03 10:25:58 +02:00
Alexander Zobnin
60ddad8fdb
Batch disable users (#17254)
* batch disable users

* batch revoke users tokens

* split batch disable user and revoke token

* fix tests for batch disable users

* Chore: add BatchDisableUsers() to the bus
2019-05-31 13:22:22 +03:00
Bernard Duggan
a0bb01103e MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros (#13086)
closes #11431
2019-05-30 09:58:29 +02:00
Oleg Gaidarenko
a3092dc57b
LDAP: remove unused function (#17351) 2019-05-29 16:12:42 +03:00
Oleg Gaidarenko
d4ef19737e
Enterprise: remove gofakeit dep (#17344)
* Enterprise: remove gofakeit dep

Since we decided to use our uuid generation inside util module

* Enterprise: result of execution of `go mod ...`
2019-05-29 15:55:51 +03:00
Abhilash Gnan
04d473b3e5 HTTP Server: Serve Grafana with a custom URL path prefix (#17048)
Adds a new [server] setting `serve_from_sub_path`. By enabling 
this setting and using a subpath in `root_url` setting, e.g.
`root_url = http://localhost:3000/grafana`, Grafana will be accessible 
on `http://localhost:3000/grafana`. By default it is set to `false` 
for compatibility reasons.

Closes #16623
2019-05-27 17:47:29 +02:00
Andrej Ocenas
151b24b95f CLI: Add command to migrate all datasources to use encrypted password fields (#17118)
closes: #17107
2019-05-27 10:47:21 +02:00
Marcus Efraimsson
b9181df212
Auth Proxy: Log any error in middleware (#17275)
Fixes so that errors happening in auth proxy middleware is logged.

Ref #17247
2019-05-27 10:38:17 +02:00
Oleg Gaidarenko
de92c360a1
LDAP: reduce API and allow its extension (#17209)
* Removes Add/Remove methods

* Publicise necessary fields and methods so we could extend it

* Publicise mock API

* More comments and additional simplifications

* Sync with master

Still having low coverage :/ - should be addressed in #17208
2019-05-27 10:36:49 +03:00
Marcus Efraimsson
5884e235fc
database: retry transaction if sqlite returns database is locked error (#17276)
Adds an additional sqlite error code 5 (SQLITE_BUSY) to the
transaction retry handler to add retries when sqlite
returns database is locked error.
More info: https://www.sqlite.org/rescode.html#busy

Ref #17247 #16638
2019-05-27 09:24:15 +02:00
Alexander Zobnin
a3a7916597
Auth: Logout disabled user (#17166)
* Feature: revoke user token when disabled

* Chore: fix linter error
2019-05-23 15:54:47 +03:00
Carl Bergquist
c87b2c9913
docs: fixes typo in provisioning docs (#17248)
closes #17196
2019-05-23 13:06:34 +02:00
Abhilash Gnan
ca6151e23f Alerting: Support for configuring content field for Discord alert notifier (#17017) 2019-05-23 08:31:02 +02:00
Oleg Gaidarenko
9b7f9dd9be
LDAP: consistently name the LDAP entities (#17203) 2019-05-22 15:30:03 +03:00
CodeLingo Bot
3ff3e0f2ac Defer closing of files (#17213)
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-05-22 08:48:47 +02:00
Alexander Zobnin
2d03815770
Users: Disable users removed from LDAP (#16820)
* Users: add is_disabled column

* Users: disable users removed from LDAP

* Auth: return ErrInvalidCredentials for failed LDAP auth

* User: return isDisabled flag in user search api

* User: mark disabled users at the server admin page

* Chore: refactor according to review

* Auth: prevent disabled user from login

* Auth: re-enable user when it found in ldap

* User: add api endpoint for disabling user

* User: use separate endpoints to disable/enable user

* User: disallow disabling external users

* User: able do disable users from admin UI

* Chore: refactor based on review

* Chore: use more clear error check when disabling user

* Fix login tests

* Tests for disabling user during the LDAP login

* Tests for disable user API

* Tests for login with disabled user

* Remove disable user UI stub

* Sync with latest LDAP refactoring
2019-05-21 14:52:49 +03:00
Ryan McKinley
1033f0f905 DataSourceMeta: add an option to get hidden queries (#17124)
* add an option to get hidden queries

* make sure you have meta

* supportsHiddenQueries

* remove spaces

* DataSources: hidden queries flag
2019-05-21 13:46:19 +02:00
Daniel Lee
fa9ffe38d2
Azuremonitor: multiple subscription support for alerting (#17195)
* fix: azuremonitor adds multi-sub support to alerting

* fix: AzureMonitor missing parameter in metadata func

getMetricMetadata function when called in the query ctrl
was missing a parameter for Subscription Id.

Also, made some tweaks to what happens when a chained
dropdown is changed to not reset all the fields that
are dependent on it.
2019-05-21 12:28:30 +02:00
Marcus Efraimsson
3b008d06b4
testdata: logs scenario (#17182)
Adds logs scenario which is quite basic and not that smart 
to begin with. This will hopefully ease development of 
Explore and support for logs in Grafana.
2019-05-21 09:21:59 +02:00
Marcus Efraimsson
c82df97bb2
testdata: scenarios returned are now sorted in a consistent way (#17181)
This makes sure the scenarios returned from API are sorted in a consistent
way and by that makes the values in scenario drop down always presented
ordered instead of jumping around.
2019-05-21 09:20:57 +02:00
Mario Trangoni
66ba2aa524 Fix gosimple issues (#17179)
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-05-21 07:50:44 +02:00
Carl Bergquist
bfa7c3d963
alerting: golint fixes for alert notifiers. (#17167) 2019-05-20 15:23:06 +02:00
Oleg Gaidarenko
a0f5923b95
LDAP: add tests for initialBind (#17132)
* LDAP: add tests for initialBind

* LDAP: clarify comment for Login()
2019-05-20 15:57:52 +03:00
Carl Bergquist
bd5bcea5d0
alerting: fix a bunch of lint issues. (#17128) 2019-05-20 12:13:32 +02:00
Oleg Gaidarenko
35f227de11
Feature: LDAP refactoring (#16950)
* incapsulates multipleldap logic under one module

* abstracts users upsert and get logic

* changes some of the text error messages and import sort sequence

* heavily refactors the LDAP module – LDAP module now only deals with LDAP related behaviour

* integrates affected auth_proxy module and their tests

* refactoring of the auth_proxy logic
2019-05-17 14:57:26 +03:00
Oleg Gaidarenko
756da8a134
Fix: tighten revive exit code & make it happy (#17127)
* Revive should fail the build

* Fix the associated errors
2019-05-17 08:35:37 +03:00
Tom Petr
73e405978b add support for periodically reloading mysql client certs (#14892) 2019-05-16 13:45:22 +02:00
Andrej Ocenas
3dbc3251d1
Chore: Deduplicate sqlstore transaction code (#17069)
* Deduplicate transaction code

* More deduplication
2019-05-16 12:39:59 +02:00
Carl Bergquist
2904e2d9fe
Alertmanager: Replace illegal chars with underscore in label names (#17002)
closes #16624
2019-05-16 11:41:57 +02:00
Oleg Gaidarenko
be66ed9dab
Chore: explore possibilities of using makefile (#17039)
* Chore: explore possibilities of using makefile

This is an exploratory commit - I wanted to see how
revive/gosec linters could be integrated with makefile and our build scripts.

Looks better then I expected :)

* Chore: make revive happy

Revive execution was not supplied with path, if you restore there is couple
errors that were popping up - so I fixed them

* Chore: make revive happy
2019-05-16 00:29:26 +03:00
Carl Bergquist
c55e6016bf
backend: replace /pkg/errors with errutil (#17065) 2019-05-15 12:20:17 +02:00
Carl Bergquist
aed3d0d3ad
Remotecache: Avoid race condition in Set causing error on insert. (#17082)
* remotecache: avoid race condition in set

since set called the database twice without transactions another
operation could insert a value before the first operation completed.
which would raise an error on insert since the data have been inserted
by the other request.

closes #17079
2019-05-15 11:24:04 +02:00
Carl Bergquist
3df94c6f27
serverlock: run tests async should be more linear time wise (#17059) 2019-05-14 15:38:18 +02:00
Andrej Ocenas
fd10aa902d
Chore: Use executable dir instead of pwd in CLI for isDev check (#16974)
* Use executable dir for the dev check

* Handle executable in bin and platform dirs

* Remove commented code

* Rename variable
2019-05-14 14:13:41 +02:00
Oleg Gaidarenko
79ac3fd699
Chore: remove use of == false (#17036)
Interestingly enough, golint or revive doesn't not prohibit
the use that construction :)

Ref #17035
2019-05-14 10:18:28 +03:00
Carl Bergquist
13f137a17d
tech: avoid alias for importing models in alerting (#17041)
ref #14679
2019-05-14 08:15:05 +02:00
Oleg Gaidarenko
29ad72f048
Chore: reintroduce gosec (#17021)
It seems gosec memory issue was recently fixed.
We should be good to go again

Ref securego/gosec#307
2019-05-13 14:56:36 +03:00
zhulongcheng
2fff8f77dc move log package to /infra (#17023)
ref #14679

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00
Ryan McKinley
1d7bb2a763 DataSourceApi: convert interface to abstract class (#16979)
* DataSourceApi as class

* add diff signature

* Prometheus: moved directUrl to jsonData
2019-05-10 11:37:43 +02:00
zhulongcheng
34f6dda6e6 Notification: attempt to send notifications to all given email addresses (#16881)
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-10 08:39:51 +02:00
Ryan McKinley
56702902a1 Plugins: Remove dataFormats key and add skipDataQuery (#16984) 2019-05-10 07:46:14 +02:00
zhulongcheng
7ebbeb09cb Snapshot: use given key and deleteKey (#16876)
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-09 11:53:04 +02:00
Torkel Ödegaard
e1d408a66f
AddDataSource: Updated page design & categories (#16971)
* minor refactoring

* Added category

* Minor progress

* Progres

* Updated descriptions

* Added custom sort

* NewDataSource: progress

* Updated design

* NewDataSource: Updated design

* Updated link

* Feedback changes
2019-05-09 11:45:39 +02:00
Carl Bergquist
a86b8c8a04
http: remove dualstack since its deprecated (#16940)
Deprecated: Fast Fallback is enabled by default. To
disable, set FallbackDelay to a negative value.

https://golang.org/src/net/dial.go
2019-05-08 10:37:48 +02:00
Ryan McKinley
17ce1273ca AppPlugin: Menu Edit Url Fix (#16934) 2019-05-08 09:38:40 +02:00
Brian Gann
b07d0b1026 Plugins: Support templated urls in routes (#16599)
This adds support for using templated/dynamic urls in routes.
* refactor interpolateString into utils and add interpolation support for app plugin routes.
* cleanup and add error check for url parse failure
* add docs for interpolated route urls

Closes #16835
2019-05-07 18:55:39 +02:00
Carl Bergquist
f001815d9d
alerting: no notification when going from nodata -> pending (#16905)
ref #16496
2019-05-07 10:34:00 +02:00
Marcus Efraimsson
32a45077e7
Elasticsearch: Fix pre-v7.0 and alerting error (#16904)
This fixes a regression introduced in #16646 where using Elasticsearch 
pre-v7.0 and alerting resulted in an error when trying to deserialize the 
response of total number of hits.
Total number of hits is not in use by the backend so we're removing it 
for now to make ES 6 and 7 being able to deserialize search responses 
without errors.

Closes #15622
2019-05-06 15:12:18 +02:00
Marcus Efraimsson
1c1427520d
Security: Add new setting allow_embedding (#16853)
When allow_embedding is false (default) the Grafana backend 
will set the http header `X-Frame-Options: deny` in all responses 
to non-static content which will instruct browser to not allow 
Grafana to be embedded in `<frame>`, `<iframe>`, 
`<embed>` or `<object>`.

Closes #14189
2019-05-06 09:56:23 +02:00
Mark Goodwin
44e6da6b41 build: fix integer overflow in pkg/tsdb tests on 32bit platforms (#16818)
Several pkg/tsdb tests fail to compile on 32bit platforms due to
integer overflow.
2019-05-06 09:27:45 +02:00
Marcus Efraimsson
f778c1d971
Security: Responses from backend should not be cached (#16848)
Currently all API requests set Cache-control: no-cache to avoid browsers 
caching sensitive data. This fixes so that all responses returned from 
backend not are cached using http headers. The exception is the data proxy 
where we don't add these http headers in case datasource backend needs 
to control whether data can be cached or not.

Fixes #16845
2019-05-06 09:22:59 +02:00
Samuel
846b9327a5 LDAP: Added reload endpoint for LDAP config (#15470)
* 4843 - Added reload endpoint for LDAP config

closes #4843

* Refactor to make the reload work after master drifted
2019-05-03 14:53:07 +02:00
Ryan McKinley
013f1b8d19
App Plugins: support react pages and tabs (#16586) 2019-05-02 10:15:39 -07:00
Stephen SORRIAUX
3866839b19 Datasources: add support for POST HTTP verb for InfluxDB (#16690)
A new parameter `queryMode` is added to the InfluxDB datasource to provide a way to use POST instead of GET when querying the database. This prevents to get any error when querying the database with a heavy request.
Default configuration is kept to GET for backward compatibility. Tests and documentation have been added for this new behaviour.
2019-05-02 15:30:37 +02:00
Marcus Efraimsson
e210725d3d
DataProxy: Restore Set-Cookie header after proxy request (#16838)
If Grafana rotates the user's auth token during a request to the data 
source proxy it will set the Set-Cookie header with new auth token in 
response before proxying the request to the datasource.
Before this fix the Set-Cookie response header was cleared after the 
proxied request was finished to make sure that proxied datasources 
cannot affect cookies in users browsers. This had the consequence 
of accidentally also clearing the new auth token set in Set-Cookie 
header.
With this fix the original Set-Cookie value in response header is now 
restored after the proxied datasource request is finished. The existing
logic of clearing Set-Cookie response header from proxied request 
have been left intact.

Fixes #16757
2019-05-01 16:32:03 +02:00
Oleg Gaidarenko
c1289b308f Chore: revise some of the gosec rules (#16713) 2019-05-01 11:36:02 +02:00
Carl Bergquist
9660356638
Auth: Enable retries and transaction for some db calls for auth tokens (#16785)
the WithSession wrapper handles retries and connection
management so the caller dont have to worry about it.
2019-04-30 14:42:01 +02:00
Andrej Ocenas
eb82a75668
Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)
* Add file path to metadata and show it in dialogs

* Make path relative to config directory

* Fix tests

* Add test for the relative path

* Refactor to use path relative to provisioner path

* Change return types

* Rename attribute

* Small fixes from review
2019-04-30 13:32:18 +02:00
Andrej Ocenas
0433af6385
Config: Fixes bug where timeouts for alerting was not parsed correctly (#16784)
* Fix parsing of the config

* Remove unnecessary conversion

* Remove timeout modification

Co-Authored-By: aocenas <mr.ocenas@gmail.com>

* Remove unused import
2019-04-30 12:05:38 +02:00
Torkel Ödegaard
9b68952482 Provisioning: Trying to fix failing test (#16800)
* Provisioning: Trying to fix test

* Use better sync strategy for test

* Lower the timeout

* Remove commented code

Co-Authored-By: aocenas <mr.ocenas@gmail.com>
2019-04-30 10:35:54 +02:00
bergquist
f7c8d90d1a phantomjs: set web-security to true 2019-04-29 14:37:52 +02:00
Oleg Gaidarenko
66c9297c36
Feature: introduce LdapActiveSyncEnabled setting (#16787)
* Feature: introduce LdapActiveSyncEnabled setting

We probably remove it after the active sync is done.
But at the moment we do not want to affect the current users
with not fully tested feature

* Chore: move settings in more logical order
2019-04-27 09:03:59 +03:00
Oleg Gaidarenko
62b85a886e
LDAP Refactoring to support syncronizing more than one user at a time. (#16705)
* Feature: add cron setting for the ldap settings

* Move ldap configuration read to special function

* Introduce cron setting (no docs for it yet, pending approval)

* Chore: duplicate ldap module as a service

* Feature: implement active sync

This is very early preliminary implementation of active sync.
There is only one thing that's going right for this code - it works.

Aside from that, there is no tests, error handling, docs, transactions,
it's very much duplicative and etc.

But this is the overall direction with architecture I'm going for

* Chore: introduce login service

* Chore: gradually switch to ldap service

* Chore: use new approach for auth_proxy

* Chore: use new approach along with refactoring

* Chore: use new ldap interface for auth_proxy

* Chore: improve auth_proxy and subsequently ldap

* Chore: more of the refactoring bits

* Chore: address comments from code review

* Chore: more refactoring stuff

* Chore: make linter happy

* Chore: add cron dep for grafana enterprise

* Chore: initialize config package var

* Chore: disable gosec for now

* Chore: update dependencies

* Chore: remove unused module

* Chore: address review comments

* Chore: make linter happy
2019-04-26 15:47:16 +03:00
Ryan McKinley
470634e2d6
Streaming: support streaming and a javascript test datasource (#16729) 2019-04-25 14:01:02 -04:00
Oleg Gaidarenko
78cd9058a3
Feature: add cron setting for the ldap settings (#16673)
* Feature: add cron setting for the ldap settings

* Move ldap configuration read to special function

* Introduce cron setting (no docs for it yet, pending approval)

* Chore: address code review comments
2019-04-25 17:12:56 +03:00
Alcides Viamontes E
cff2be0d66 elasticsearch: add 7.x version support (#16646)
Adds a new version option 7.0+ (70 internally).
Version 7.0+ doesn't include document types in index mappings 
so support for handling this have been added.
Version 7.0+ returns number of hits in a different way so 
support for handling this have been added.
Version 7.0+ doesn't support sending 
max_concurrent_shard_requests in multisearch header so 
support for sending this in query string have been added.
Update elastic6 docker block and dashboards (devenv) to use 
6.7.1 images, filebeat index name is now filebeat-YYYY.MM.DD 
and dashboard include correct tags and links.
Add elastic7 docker block and provisioning (devenv).
Updates documentation regarding new version.

Closes #15622
2019-04-25 09:41:13 +02:00
Andrej Ocenas
42b745a098
Provisioning: Add API endpoint to reload provisioning configs (#16579)
* Add api to reaload provisioning

* Refactor and simplify the polling code

* Add test for the provisioning service

* Fix provider initialization and move some code to file reader

* Simplify the code and move initialization

* Remove unused code

* Update comment

* Add comment

* Change error messages

* Add DashboardProvisionerFactory type

* Update imports

* Use new assert lib

* Use mutext for synchronizing the reloading

* Fix typo

Co-Authored-By: aocenas <mr.ocenas@gmail.com>

* Add docs about the new api
2019-04-25 09:06:44 +02:00
Hofls
b3bfbc6f77 Config: Show user-friendly error message instead of stack trace (#16564)
Fixes #16283
2019-04-25 08:29:07 +02:00
Tom Petr
2d6b33ab61 sqlstore: use column name in order by (#16583)
Use column name in ORDER BY in GetDashboardAclInfoList().
2019-04-24 16:05:35 +02:00
Andrej Ocenas
fcebd713a5
Provisioning: Interpolate env vars in provisioning files (#16499)
* Add value types with custom unmarshalling logic

* Add env support for notifications config

* Use env vars in json data tests for values

* Add some more complexities to value tests

* Update comment with example usage

* Set env directly in the tests, removing patching

* Update documentation

* Add env var to the file reader tests

* Add raw value

* Post merge fixes

* Add comment
2019-04-24 15:39:47 +02:00
Carl Bergquist
eb8af01a8a
admin: add more stats about roles (#16667)
closes #14967
2019-04-24 13:18:16 +02:00
Marcus Efraimsson
7dadebb3f0
playlist: fix loading dashboards by tag (#16727)
Fixes #16704
2019-04-24 10:10:16 +02:00
Utkarsh Bhatnagar
89a01a680c CloudWatch: Use default alias if there is no alias for metrics (#16732)
Fixes #16605
2019-04-24 10:00:02 +02:00
Josh
fca5ee4bea Provisioning: Support FolderUid in Dashboard Provisioning Config (#16559)
* add folderUid to DashbaordsAsConfig structs and DashbardProviderConfigs struct, set these values in mapping func
look for new folderUid values in config_reader tests
set dashboard folder Uid explicitly in file_reader, which has no affect when not given

* formatting and docstrings

* add folderUid to DashbaordsAsConfig structs and DashbardProviderConfigs struct, set these values in mapping func
look for new folderUid values in config_reader tests
set dashboard folder Uid explicitly in file_reader, which has no affect when not given

* formatting and docstrings

* add folderUid option, as well as documentation for the rest of the fields

* add blank folderUid in devenv example.

* add folderUid to provisioning sample yaml

* instead of just warning, return error if unmarshalling dashboard provisioning file fails

* Removing the error handling and adding comment

* Add duplicity check for folder Uids


Co-authored-by: swtch1 <joshua.thornton@protonmail.com>
2019-04-24 08:57:42 +02:00
Andrej Ocenas
e4f649e2c8
Chore: Small improvements to grafana-cli (#16670)
* Small improvements

* Better error handling
2019-04-23 12:34:34 +02:00
Andrej Ocenas
c429934a66
Chore: Use x/xerrors instead of pkg/errors (#16668)
* Use xerrors instead of pkg/errors

* Add Wrap util func

* Move Wrap to errutil package
2019-04-23 11:50:31 +02:00
Oleg Gaidarenko
54c1bf0cc9
Chore: a bit of spring cleaning (#16710)
* Chore: use early return technic everywhere

And enable "indent-error-flow" revive rule

* Chore: remove if-return rule from revive config

* Chore: improve error messages

And enable "error-strings" revive rule

* Chore: enable "error-naming" revive rule

* Chore: make linter happy

* Chore: do not duplicate gofmt execution

* Chore: make linter happy

* Chore: address the pull review comments
2019-04-23 11:24:47 +03:00
Oleg Gaidarenko
db584b3d28
Chore: remove session storage references (#16445)
* Chore: remove session storage references

* Small refactoring of the settings module

* Update docs - remove references for the session storage

* Update config files (sample and default configs)

* Add tests for warning during the config load on defined storage cache

* Remove all references to session storage

* Remove macaron session dependency

* Remove leftovers

* Fix: address review comments

* Fix: remove old deps

* Fix: add skipStaticRootValidation = true to tests

* Fix: improve the docs and warning message

As per discussion in here - https://github.com/grafana/grafana/pull/16445/files#r273026255

* Chore: make linter happy

Fixes #16148
Ref #16114
2019-04-22 18:58:24 +03:00
Torkel Ödegaard
36d64fecea
Search: Fixed search issue introduced in recent PR (#16652) 2019-04-17 19:07:13 +02:00
Carl Bergquist
e4eb0817e4 Cloudwatch: fix for flaky tests (#16649)
The iteration order over maps is not specified and is not guaranteed
to be the same from one iteration to the next. If a map entry that
has not yet been reached is removed during iteration, the corresponding
iteration value will not be produced. If a map entry is created during
iteration, that entry may be produced during the iteration or may be skipped.
The choice may vary for each entry created and from one iteration to
the next. If the map is nil, the number of iterations is 0.

https://golang.org/ref/spec#For_range
2019-04-17 19:06:32 +02:00
Torkel Ödegaard
8b0dd4244b
Search: Fixes search limits and adds a page parameter (#16458)
* Search: Fixes search limits and adds a page parameter

This adds a page parameter to search api without adding
any major breaking change.

It does at an api validation error when trying to use
a limit beyond 5000. This is a breaking change. We could
remove this and have it only in the docs and describe that this
is a limit that grafana will apply silently.

Fixes #16049

* Fix: Corrected wrong array slice change

* Docs: minor docs fix

* Search: fixed folder tests

* Fixed: Moved limit to correct inner query

* Search: moving limit check and page check

* Search: limit in handler is no longer needed
2019-04-17 13:07:50 +02:00
Carl Bergquist
3f136e0da9
tech: replace bmizerany/assert with stretchr/testify (#16625)
bmizerany is old and unsupported. so we are replacing it
with stretchr which is an drop in replacement and something
we want to use more in Grafana.
2019-04-17 10:25:58 +02:00
Torkel Ödegaard
75f9adf44f
Build: adding dependency used by extensions (#16622) 2019-04-16 15:26:39 +02:00
Oleg Gaidarenko
318182ccc9 Chore: refactor auth proxy (#16504)
* Chore: refactor auth proxy

Introduced the helper struct for auth_proxy middleware.
Added couple unit-tests, but it seems "integration" tests already cover
most of the code paths.

Although it might be good idea to test every bit of it, hm.
Haven't refactored the extraction of the header logic that much

Fixes #16147

* Fix: make linters happy
2019-04-16 14:09:18 +02:00
Carl Bergquist
68f5ddf18c
replace dep with go modules (#16017)
- guide shamelessly stolen from prometheus/prometheus
- updates local interface of oauth exchange
- updates local impl of hclogger
- bump jaeger client version

closes #16088
2019-04-16 12:00:55 +02:00
Carl Bergquist
490515aec6
build: partially replace gometalinter with golangci-lint (#16610)
we still use gometalinter for goconst since it doesn't 
report errors for duplicated in test files
2019-04-16 10:27:07 +02:00
Mitsuhiro Tanda
864a6262fe CloudWatch: GetMetricData refactoring & fix label handling (#16383)
* fix label handling

* SEARCH() results could have multiple namespace, remove from legend

* divide GetMetricStatistics related code

* divide GetMetricData related code

* divide parseGetMetricDataResponse()

* divide parseGetMetricDataQuery()

* divide test code

* add test for GetMetricData

* add test for GetMetricData parse response

* fix bug of terminating gap

* fix gofmt
2019-04-15 17:55:07 +02:00
Oleg Gaidarenko
b37ee65bd3
Chore: prepare our SQL for cockroach db (#16471)
This is basically implementation of the https://github.com/grafana/grafana/issues/8900#issuecomment-435437167
points, except for the type conversion bit.

I tried to implement idea mentioned in cockroachdb ticket (see below).
And it is possible, but it complicates things as lot - not only we have to
have 4 SQL statements instead of one, but we would have to copy the column
structure as well - PK, FG, indexes and stuff, plus there will
be additional downtime with this approach.

So idea for this pull is to prepare our SQL as much as possible, so when
cockroachdb will add support for full type conversions, we could easilly add
support for it as well.

* Add `CASCADE` to `DROP INDEX` statement

* Make string conversions explicit

Thanks @Luit

Ref #8900
Ref cockroach/cockroach#9851
2019-04-15 18:49:24 +03:00
Andrej Ocenas
66f6e16916
Security: Store datasource passwords encrypted in secureJsonData (#16175)
* Store passwords in secureJsonData

* Revert unnecessary refactors

* Fix for nil jsonSecureData value

* Remove copied encryption code from migration

* Fix wrong field reference

* Remove migration and provisioning changes

* Use password getters in datasource proxy

* Refactor password handling in datasource configs

* Add provisioning warnings

* Update documentation

* Remove migration command, moved to separate PR

* Remove unused code

* Set the upgrade version

* Remove unused code

* Remove double reference
2019-04-15 11:11:17 +02:00
Carl Bergquist
9134251417
build: upgrades to golang 1.12.4 (#16545)
fix govet issue in golang 1.12.4
2019-04-15 09:18:28 +02:00
Hofls
c17226af95 Pushover alert, support for different sound for OK (#16525)
Closes #15889
2019-04-12 14:57:17 +02:00
Ryan McKinley
3c21a121eb Plugins: Unifying alpha state & options for all plugins (#16530)
* app pages

* app pages

* workign example

* started alpha support

* remove app stuff

* show warning on alpha/beta panels

* put app back on plugin file

* fix go

* add enum for PluginType and PluginIncludeType

* Refactoring and moving settings to plugins section

fixes #16529
2019-04-12 13:46:42 +02:00
Carl Bergquist
30dcf0f6c5
Revert "Build: Upgrades to go 1.12.3 (#16491)" (#16544)
This reverts commit 44b365028f.
2019-04-12 11:17:31 +02:00
Carl Bergquist
44b365028f
Build: Upgrades to go 1.12.3 (#16491)
fixes go vet issue that 1.12.3 detects
2019-04-12 09:44:02 +02:00
Dan Cech
b9cc476eb7 Update jwt regexp to include = (#16521)
Fixes #16501
2019-04-11 15:30:55 +02:00
Ryan McKinley
d6887bf77f Plugins: Optionally preload some plugins during frontend app boot (#15266)
* auto load

* update comments

* gofmt

* use preload from json

* fix formatting

* change general plugin loader to app

* Refactoring: Plugin preloading #15266
2019-04-11 08:02:22 +02:00
Andrej Ocenas
2d7fc55df7
Provisioning: Do not allow deletion of provisioned dashboards (#16211)
* Unprovision dashboard in case of DisableDeletion = true

* Rename command struct

* Handle removed provision files

* Allow html in confirm-modal

* Do not show confirm button without onConfirm

* Show dialog on deleting provisioned dashboard

* Changed DeleteDashboard to DeleteProvisionedDashboard

* Remove unreachable return

* Add provisioned checks to API

* Remove filter func

* Fix and add tests for deleting dashboards

* Change delete confirm text

* Added and used pkg/errors for error wrapping
2019-04-10 13:29:10 +02:00
Oleg Gaidarenko
67cbc7d4cf
Chore: use remote cache instead of session storage (#16114)
Replaces session storage in auth_proxy middleware with remote cache

Fixes #15161
2019-04-08 14:31:46 +03:00
Marcus Efraimsson
5da1faf454
Alerting: Notification channel http api fixes (#16379)
Fixes so it's possible to create new notification channel and providing uid.
Fixes better error/result handling when updating a notifcation channel.

Fixes #16372
Ref #16219 #16012
2019-04-04 17:52:40 +02:00
Andrej Ocenas
08ce7f6c93
Chore: Add task to find FocusConvey tests (#16381) 2019-04-04 14:48:11 +02:00
The Rock Guy
335aa7c9f2 CloudWatch: Update AWS/IoT metric and dimensions (#16337)
Closes #16334
2019-04-04 12:54:20 +02:00
Marcus Efraimsson
79b86466fd Fix: Alerting Notification channel http api fixes (#16288)
Fix so that uid can be changed when updating notification
channels through the http api.
Update documentation
2019-03-29 09:42:38 +01:00
Zzy
1b84a924a3 Alerting: Makes timeouts and retries configurable (#16259)
Adds new alert settings for configuring timeouts and retries named 
evaluation_timeout_seconds, notification_timeout_seconds 
and max_attempts.

Closes #16240
2019-03-29 12:58:37 +07:00
Oleg Gaidarenko
1d955a8762
Chore: Implement gosec (#16261)
See https://github.com/securego/gosec for more info.

Disabled a lot of rules. I guess we should go through them
and recheck if we really need to disable some

Fixes #16204
2019-03-28 14:17:07 +01:00
Oleg Gaidarenko
04b3afcd15
Chore: Implement revive (#16200)
Since we do not like some of the default golint rules,
this commit proposes to use https://github.com/mgechev/revive.

And potential revive speed-up should't hurt :).

Right now, presented config (./conf/revive.toml) is permissive,
we might improve it over time however. Fixes for found revive
issues in the code are very limited so it wouldn't be large to review.

Also in this commit:

* Add annotations for makefile commands and declare phony targets

* Rename "gometalinter" script and CI command to "lint"
  since we are doing there a bit more then using gometalinter package

* Add Makefile rules to .editorconfig

* Documentation which mentioned "golint" replaced with revive

Fixes #16109
Ref #16160
2019-03-27 17:53:49 +01:00
Floyd May
33d1d427bc InfluxDB: Fix tag names with periods in alerting (#16255)
Updates regex to match tag names with periods when generating
series names in alerting evaluation (backend).

Fixes #9148
2019-03-27 23:13:12 +07:00
Navaneesh Kumar
5ea823a65a Fix: Alert email variable name typo fixed (#16232) 2019-03-27 09:42:20 +01:00
Marcus Efraimsson
2ae63e70c0
Alerting: Notification channel http api enhancements (#16219)
Now returns uid in response to get notification channel by id.
Adds GET/PUT/DELETE support for notification channel by uid, 
  /api/alert-notifications/uid/:uid.
Break apart alerting and alert notification http api docs in two 
  pages and update documentation to make it up to date
  with current implementation.

Fixes #16012
2019-03-26 18:37:02 +07:00
Marcus Efraimsson
6b8e3122f8
chore(influx): no point of reading response when bad status (#16212)
There's no point in reading the body response without using
the result so removing it.

Fixes #9199
Ref #16207
2019-03-26 12:10:24 +07:00
Daniel Lee
fda7e686f3
Merge pull request #15205 from seanlaff/12556-oauth-pass-thru
Add oauth pass-thru option for datasources
2019-03-25 21:52:20 +01:00
Ramon Carvalho Maciel
d791a6211d fix(InfluxDB): Reads body and close request body even for error status codes (#16207) 2019-03-25 17:42:26 +01:00
Torkel Ödegaard
7c81f4dfd8
fix(Alerting): Fixed alert rules with eval in day units, fixes #16174 (#16182) 2019-03-25 16:27:58 +01:00
Daniel Lee
c7d108264d
Merge pull request #16137 from mtanda/cloudwatch_update_metrics_list
update cloudwatch metrics/dimensions list
2019-03-25 14:42:15 +01:00
Torkel Ödegaard
46a75099d8
Merge pull request #16116 from SGI495/master
Don't include non-existing image in MS Teams alert
2019-03-22 09:34:56 +01:00
Mitsuhiro Tanda
4d8eb76dca update cloudwatch metrics/dimensions list 2019-03-22 00:08:17 +09:00
Sean Lafferty
50c5854430 Use grafana's logger implementation 2019-03-21 08:13:03 -04:00
Mitsuhiro Tanda
56251ca546 Update CloudWatch metrics/dimension list (#16102)
update cloudWatch metrics/dimension list
2019-03-21 11:13:06 +01:00
Sean Lafferty
b3461c9806 Remove sleeps in test code by overriding time.Now() 2019-03-20 15:34:31 -04:00
Sean Lafferty
3b9b6c571a Abstract encrypt/encode and decode/decrypt into their own functions 2019-03-20 15:18:22 -04:00
Sean Lafferty
b696492891 Rename dispatched commands to make them easy to grok 2019-03-20 14:32:41 -04:00
Sean Lafferty
be6e76ee35 Use structured logging instead of printf 2019-03-20 14:25:26 -04:00
Magnus Berglund
e6623de6b2 Rewrote creation of images tag 2019-03-20 18:59:13 +01:00
Magnus Berglund
0511095303 Added missing commas 2019-03-20 18:42:48 +01:00
Magnus Berglund
0de77598d7 Don't include non-existing image in MS Teams alert
If an image section is included in the JSON payload for MS Teams alerts
when no image URL exists, rendering of the alert in the client fails.
This change makes sure that an image section is only included in the
JSON payload if an image URL exists.

Closes #16082
2019-03-20 18:23:36 +01:00
Oleg Gaidarenko
30f0c35006
Merge pull request #16104 from markelog/remotecache-small-fix
Correct table names of sql storage for remotecache
2019-03-20 14:08:02 +01:00
Oleg Gaidarenko
c5bc723a6e Correct table names of sql storage for remotecache 2019-03-20 13:24:56 +01:00
Torkel Ödegaard
d11695b8b5 Fixed gofmt issue in PR #16093 2019-03-20 10:58:20 +01:00
Sai Ram Gupta
6929593eb6
Update org_user.go
Add check for, if current role is ROLE_VIEWER, return true if the role I'm checking for is ROLE_VIEWER. Fixes #16092
2019-03-19 11:31:55 -07:00
Leonard Gram
978c20a604 teams: explains the external property of a team membership. 2019-03-19 14:01:22 +01:00
Hugo Häggmark
53c74fa2f5 teams: refactor so that you can only delete teams if you are team admin 2019-03-19 14:01:21 +01:00
Leonard Gram
a615b78f8a permissions: removes global access to bus from MakeUserAdmin. 2019-03-19 14:01:20 +01:00
Leonard Gram
adf0390b2c teams: local access to bus, moving away from dep on global. 2019-03-19 14:01:20 +01:00
Leonard Gram
6589a4e55f teams: better names for api permissions. 2019-03-19 14:01:20 +01:00
Leonard Gram
9f33f00343 teams: refactor. 2019-03-19 14:01:19 +01:00
Leonard Gram
9f8e43916d permissions: refactor. 2019-03-19 14:01:19 +01:00
Leonard Gram
b796027bc6 teams: refactor. 2019-03-19 14:01:19 +01:00
Leonard Gram
d1481cac50 teams: refactored db code. 2019-03-19 14:01:18 +01:00
Hugo Häggmark
6a63725df0 teams: comment explaining input validation
Co-Authored-By: xlson <leo@xlson.com>
2019-03-19 14:01:17 +01:00
Leonard Gram
3f57a81c47 teams: cleanup. 2019-03-19 14:01:16 +01:00
Leonard Gram
ccfd6789ca teams: cleanup. 2019-03-19 14:01:16 +01:00
Leonard Gram
fc0461134f dashboards: simplified code. 2019-03-19 14:01:15 +01:00
Hugo Häggmark
b60e71c28b teams: moved logic for searchteams to backend 2019-03-19 14:01:15 +01:00
Hugo Häggmark
782b5b6a3a teams: viewers and editors can view teams 2019-03-19 14:01:14 +01:00
Leonard Gram
c420af16b1 teams: editor/viewer team admin cant remove the last admin. 2019-03-19 14:01:14 +01:00
Hugo Häggmark
246e128048 teams: changed permission to permission type instead of int 2019-03-19 14:01:14 +01:00
Hugo Häggmark
c826f39a8b teams: defaulting invalid permission level to member permission level 2019-03-19 14:01:13 +01:00
Leonard Gram
c823ad5de7 team: uses PermissionType instead of int64 for permissions. 2019-03-19 14:01:13 +01:00
Leonard Gram
21d3d27452 teams: editors can't remove the last admin from a team. 2019-03-19 14:01:13 +01:00
Leonard Gram
b783fa7039 team: renames teams.CanUpdate teamguardian.CanAdmin 2019-03-19 14:01:12 +01:00
Hugo Häggmark
a90b3e331e config: updated feature toggle name 2019-03-19 13:59:39 +01:00
Leonard Gram
a6a3d698da teams: cleanup. 2019-03-19 13:57:30 +01:00
Leonard Gram
0b209de5d1 dashboard: only admin permission added to dashboard in folder. 2019-03-19 13:57:30 +01:00
Leonard Gram
d593ffe3c1 dashboards: better error handling 2019-03-19 13:57:30 +01:00
Leonard Gram
89d4db8eb6 teams: team listing shows only your teams (editors). 2019-03-19 13:57:29 +01:00
Leonard Gram
1f949e58e1 teams: teams guard on all teams update methods. 2019-03-19 13:57:29 +01:00
Leonard Gram
23231e6d51 teams: added delete team guard 2019-03-19 13:57:29 +01:00
Leonard Gram
8e7a8282c1 teams: removed feature toggle as it is already in middleware 2019-03-19 13:57:28 +01:00
Leonard Gram
d668550aa2 teams: added feature toggle and refactor tests 2019-03-19 13:57:28 +01:00
Leonard Gram
0d61f89577 teams: cleanup. 2019-03-19 13:57:28 +01:00
Leonard Gram
3be1d71f1f teams: test refactorings. 2019-03-19 13:57:27 +01:00
Leonard Gram
319879cfa8 teams: bugfix, user pointer. 2019-03-19 13:57:27 +01:00
Leonard Gram
90e9fda90c teams: start of team update guardian for editors 2019-03-19 13:57:26 +01:00
Hugo Häggmark
5adde259d3 teams: team update test 2019-03-19 13:57:26 +01:00
Hugo Häggmark
3c46b786d2 teams: change back to permissionlevel for Member to 0 2019-03-19 13:57:26 +01:00
Hugo Häggmark
3c74ac3044 teams: update only the selected user 2019-03-19 13:57:25 +01:00
Hugo Häggmark
074ebf0f48 teams: only write error message if error 2019-03-19 13:57:25 +01:00
Leonard Gram
aedc478208 teams: test for update team member. 2019-03-19 13:57:24 +01:00
Leonard Gram
2a88052c14 teams: can update team members permission. 2019-03-19 13:57:23 +01:00
Hugo Häggmark
7888457aae teams: basic ui for permission in team members view 2019-03-19 13:57:23 +01:00
Leonard Gram
af4994ba16 teams: editor added as admin for created teams. 2019-03-19 13:57:22 +01:00
Leonard Gram
22e098b830 teams: editors can work with teams. 2019-03-19 13:57:22 +01:00
Hugo Häggmark
efbd93f824 teams: show teams and plugins for editors that can own 2019-03-19 13:57:22 +01:00
Hugo Häggmark
124fb743e8 teams: make test cases pass again 2019-03-19 13:57:21 +01:00
Leonard Gram
da3dcd1918 folder: uses service to make user admin of created folder. 2019-03-19 13:57:21 +01:00
Leonard Gram
c8c004095c permissions: broken out func for making creator admin. 2019-03-19 13:57:21 +01:00
Leonard Gram
e174f7c20b folders: admin for created folders 2019-03-19 13:57:20 +01:00
Leonard Gram
e294252e92 dashboards: user automatically becomes admin for created dashboards 2019-03-19 13:57:20 +01:00
ryan
bd811b4a95 dont test exists in the test... it will fail if not found 2019-03-15 12:36:55 -07:00
ryan
24ead3a4a4 add random_walk_table scenario 2019-03-15 12:33:45 -07:00
ryan
2b5ac6bafa add test file 2019-03-15 11:07:20 -07:00
ryan
e787176bca add startAt to random walk scenario 2019-03-15 11:02:41 -07:00
Andrej Ocenas
09b9b595b2 Add check for Env before log 2019-03-15 11:53:30 +01:00
Sean Lafferty
3f9a19dcd5 Merge branch 'master' into 12556-oauth-pass-thru 2019-03-14 13:18:00 -04:00
Andrej Ocenas
8221c4273f
Merge pull request #15998 from grafana/add-grafana-user-proxy-header
Add custom header with grafana user when using proxy
2019-03-14 17:29:06 +01:00
Carl Bergquist
23852b59c9
Merge pull request #15839 from grafana/15836_revoke_auth_tokens
Support list and revoke of user auth tokens in HTTP API
2019-03-14 17:12:49 +01:00
Andrej Ocenas
697a87b7b2 Add check so that header is not sent for anonymous users 2019-03-14 16:33:21 +01:00
Andrej Ocenas
bbdc1c0e64 Add custom header with grafana user and a config switch for it 2019-03-14 16:33:19 +01:00
Carl Bergquist
291ffcb75b
Merge pull request #15457 from bergquist/distributed_cache
Distributed cache
2019-03-14 16:16:39 +01:00
bergquist
6d42d43b22 use constants for cache type 2019-03-14 15:48:20 +01:00
Sean Lafferty
f3c52710df Make recently used auth_module test more robust by adding another 'log in' 2019-03-14 08:40:19 -04:00
bergquist
0a86a1d7b6 updates old distcache names 2019-03-14 09:23:35 +01:00
bergquist
c001cfe1d9 dont allow inifinite expiration 2019-03-14 09:22:03 +01:00
bergquist
5186273731 return error if cache type is invalid 2019-03-14 08:57:38 +01:00
zhulongcheng
755f60358b Add more info to victorOps alert notifications 2019-03-14 15:47:11 +08:00
Sean Lafferty
fcc18d8121 Change import path for social in the tests 2019-03-13 14:55:22 -04:00
Sean Lafferty
8d8119aa98 Change import path for social since it has moved 2019-03-13 14:34:55 -04:00
Sean Lafferty
8d19ca005f Merge branch 'master' into 12556-oauth-pass-thru 2019-03-13 14:25:43 -04:00
Sean Lafferty
de338338bf Remove todo about index on user_id in user_auth because it exists 2019-03-13 13:46:49 -04:00
Sean Lafferty
7e62394d01 Add function in ds_proxy to handle oauthPassThru headers 2019-03-13 13:45:32 -04:00
Sean Lafferty
4324a7f51a Remove auth module from ds_proxy oauth test 2019-03-13 13:28:49 -04:00
Sean Lafferty
3b15e110a5 Get most recent oauth token from db, rather than lookup by auth_module 2019-03-13 13:22:22 -04:00
Sean Lafferty
f17307bb97 Always return most recently used auth_module from GetAuthInfo 2019-03-13 11:29:13 -04:00
Torkel Ödegaard
9e7d1f4275
Merge pull request #15466 from grafana/bar-gauge-poc
New Bar Gauge panel
2019-03-13 11:12:33 +01:00
bergquist
f13263eb54 reduce loglevel to debug 2019-03-13 09:01:45 +01:00
Torkel Ödegaard
71159fb606 Merge remote-tracking branch 'origin/master' into bar-gauge-poc 2019-03-13 08:26:06 +01:00
Sean Lafferty
d922285ab8 Move oauth token migrations in user_auth_mig 2019-03-11 09:31:03 -04:00
Torkel Ödegaard
647cb6ddae Merge branch 'master' of https://github.com/joshuawoodward/grafana into joshuawoodward-master 2019-03-11 13:10:45 +01:00
bergquist
7aeab0a235 use Get instead of Find 2019-03-11 11:04:56 +01:00
Torkel Ödegaard
90a3bc2203
Merge pull request #15892 from sandlis/14706-es-weekly-pattern-fix
Fix: #14706 Incorrect index pattern padding in alerting queries
2019-03-11 11:01:22 +01:00
Torkel Ödegaard
5fab1e89d3
Merge pull request #15897 from grafana/revert-15608-fix-datasource-update
Revert "Fix Datasource Update to no User/Password"
2019-03-11 10:58:28 +01:00
bergquist
b2967fbb37 avoid exposing cache client directly 2019-03-11 10:49:56 +01:00
bergquist
7e7427637c renames distcache -> remotecache 2019-03-11 10:49:55 +01:00
bergquist
66e71b66dd renames key to cache_key
apparently key is a reserved keyword in mysql.
and the error messages doesnt mention that.
can I please have 6h back?
2019-03-11 10:49:55 +01:00
bergquist
daa3b17951 code layouts and comments 2019-03-11 10:49:42 +01:00
Torkel Ödegaard
3f574d3e57
Merge pull request #15685 from utkarshcmu/fix-#15562
Fixed alias in Cloudwatch Expressions
2019-03-11 10:49:30 +01:00
bergquist
9a78c23165 rename put -> set 2019-03-11 10:49:10 +01:00
bergquist
98f5432659 memcache -> memcached
https://github.com/memcached/memcached
2019-03-11 10:49:09 +01:00
bergquist
995647be2c removes memory as distcache option
if database caching is to expensive if should
not use distcache in the first place.
2019-03-11 10:49:09 +01:00
bergquist
b933b4efc8 test redis and memcached during integration tests 2019-03-11 10:49:09 +01:00
bergquist
196cdf9710 adds config to default settings 2019-03-11 10:49:09 +01:00
bergquist
f9f2d9fcf3 avoid exporting test helpers 2019-03-11 10:49:09 +01:00
bergquist
33935b09f0 uses set instead of add for memcache
set always sets the value regardless.
2019-03-11 10:49:09 +01:00
bergquist
8db2864fee adds memory as dist storage alt 2019-03-11 10:49:09 +01:00
bergquist
a60bb83a70 extract tests into seperate files 2019-03-11 10:49:09 +01:00
bergquist
c8ff698d90 avoid exposing internal structs and functions 2019-03-11 10:49:04 +01:00
Carl Bergquist
f3753712e0
Revert "Fix Datasource Update to no User/Password" 2019-03-11 07:22:54 +01:00
genofire
6d578dd372
fix imageurl in notification test
skip unnecessary http -> https redirect, which could make problems on some notifiers
2019-03-11 00:23:07 +01:00
Torkel Ödegaard
570187384b
Merge pull request #13825 from athurg/optimize_dingding_alert_message
Optimize dingding alert message
2019-03-08 15:33:24 +01:00
Marcus Efraimsson
0cd5a6772d
feat(api): support list/revoke auth token in admin/current user api 2019-03-08 15:15:38 +01:00
Marcus Efraimsson
8029e48588
support get user tokens/revoke all user tokens in UserTokenService 2019-03-08 15:15:17 +01:00
Marcus Efraimsson
4f48ed3350
Merge pull request #15872 from grafana/15643_fix2
fix allow anonymous server bind for ldap search
2019-03-08 14:25:58 +01:00
Marcus Efraimsson
e3b3062107
add nil/length check when delete old login attempts 2019-03-08 13:31:46 +01:00
Marcus Efraimsson
c242d38301
fix allow anonymous server bind for ldap search 2019-03-08 13:16:35 +01:00
bergquist
11d671c637 add support for memcached 2019-03-08 09:09:28 +01:00
bergquist
5ced863f75 add support for redis storage 2019-03-08 09:09:27 +01:00
bergquist
d99af23946 add garbage collector for database cache 2019-03-08 09:09:27 +01:00
bergquist
996d5059b1 test at interface level instead impl 2019-03-08 09:09:27 +01:00
bergquist
d4f5789660 cache: initial version of db cache 2019-03-08 09:09:27 +01:00
Woodward, Joshua
946e542412 Make password hint configurable from settings/defaults.ini 2019-03-07 14:00:04 -08:00
Torkel Ödegaard
64a7d8cefe
Merge pull request #15833 from grafana/15694_fix
fix discord notifier so it doesn't crash when there are no image generated
2019-03-06 17:32:34 +01:00
Marcus Efraimsson
f21c976b27
fix discord notifier so it doesn't crash when there are no image generated 2019-03-06 17:03:14 +01:00
Torkel Ödegaard
71311b1e79
Merge pull request #15827 from grafana/12926_fix
Fix restore to current folder when restoring old dashboard version
2019-03-06 15:38:06 +01:00
Torkel Ödegaard
8ba4eb47e7
Merge pull request #15769 from grafana/15768_xorm_upgrade
upgrade xorm packages to latest versions
2019-03-06 15:11:06 +01:00
Marcus Efraimsson
cf500f3157
restore to current folder when restoring old dashboard version 2019-03-06 14:38:40 +01:00
Marcus Efraimsson
36f3accf0d
log phantomjs output even if it timeout and include orgId when render alert 2019-03-06 13:53:23 +01:00
Marcus Efraimsson
f845a3b841
upgrade xorm packages to latest versions 2019-03-05 21:11:23 +01:00
Marcus Efraimsson
3b9f0e6ef2
fix allow anonymous initial bind for ldap search 2019-03-05 18:03:07 +01:00
Carl Bergquist
71bfefa8fb
Merge pull request #15608 from Maddin-619/fix-datasource-update
Fix Datasource Update to no User/Password
2019-03-05 14:38:32 +01:00
bergquist
ae9327ff3a remove UseBool since we use AllCols 2019-03-05 13:41:40 +01:00
Hugo Häggmark
d3642a3e91
Moved Server Admin and children to separate menu item on Side Menu (#15592)
* Moved Server Admin and children to separate menu item on Side Menu

* Removed style guide after PR comments
2019-03-05 13:02:41 +01:00
Johannes Schill
a81d5486b0 Viewers with viewers_can_edit should be able to access /explore (#15787)
* fix: Viewers with viewers_can_edit should be able to access /explore #15773

* refactoring initial PR a bit to simplify function and reduce duplication
2019-03-05 12:41:01 +01:00
Torkel Ödegaard
b787811da8
Merge pull request #15761 from grafana/15708_access
fix: limit access to org admin and alerting pages
2019-03-05 09:17:20 +01:00
Marcus Efraimsson
5638c67be8
org admins should only be able to access org admin pages 2019-03-04 15:51:18 +01:00
Marcus Efraimsson
a29b99b96b
only editor/admin should have access to alert list/notifications pages 2019-03-04 15:48:07 +01:00
Bryan T. Richardson
ae23773db3 Added MaximumUsedTransactionIDs metric to list of AWS RDS metrics. 2019-03-04 07:38:36 -07:00
Torkel Ödegaard
b4df0e73cd
Merge pull request #15706 from grafana/15656-playlists-with-tags-rebased
wip: Fix playlists "by tags"
2019-03-04 09:00:28 +00:00
sandeep
e04218e550 Fix: #14706 Incorrect index pattern padding in alerting queries
When weekly index pattern is used, indices names contain single digit week number for week 1-9
This fix makes sure indice names always contain 2 digit week number for weekly pattern
2019-03-03 18:10:38 +05:30
Marcus Efraimsson
d49f0bedd3 fix: prevent datasource json data stored as nil (#15508)
prevent datasource json data stored as nil

closes #14239
2019-03-02 21:18:26 +01:00
Samuel
41024c29bb Return 404 on user not found (#15606)
Return 404 on user not found

closes #10506
2019-03-02 20:34:48 +01:00
Johannes Schill
8d5ccc7831 fix: Return url when query dashboards by tag 2019-02-28 10:44:39 +01:00
utkarshcmu
37033080b7 Removed commented code 2019-02-27 00:33:40 -08:00
utkarshcmu
8ef3aebc29 Fixed alias in Cloudwatch Expressions 2019-02-27 00:20:29 -08:00
Leonard Gram
36788183d8 service: fix for disabled internal metrics.
Update of the internal metrics for Grafana was
disabled by mistake when refactoring the code.

Fixes #15651
2019-02-26 11:41:55 +01:00
Carl Bergquist
369aa2d5dd
Merge pull request #15628 from bergquist/move_tracing_infra
moves tracing packge into /infra
2019-02-25 16:16:45 +01:00
bergquist
60fef31748 moves social package to /login
ref #14679
2019-02-25 15:30:40 +01:00
bergquist
0c67194b45 moves tracing packge into /infra 2019-02-25 15:29:25 +01:00
Carl Bergquist
0aa61c8e12
Merge pull request #15629 from bergquist/moves_metrics_to_infra
moves metric package to /infra
2019-02-25 02:44:09 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Daniel Lee
d1e249a803 stackdriver: fix for float64 bounds for distribution metrics
Adds support for explicit distribution metrics and float64 bounds

Fixes #14509
2019-02-24 17:37:26 +01:00
Hugo Häggmark
769ad21e16 Moved variable to config struct after PR comments 2019-02-22 14:39:22 +01:00
Hugo Häggmark
9c9691f7af Added feature toggle editors_can_own 2019-02-22 14:39:22 +01:00
Maddin-619
09cd173e92 updates all cols except created so user and password
of the database can be chaned to no user and password
2019-02-22 14:19:15 +01:00
Hugo Häggmark
dafcfd70a7 Fixed bug with getting teams for user 2019-02-22 14:07:18 +01:00
Peter Holmberg
5f56a07a23 Merge branch 'master' into bar-gauge-poc 2019-02-19 15:43:08 +01:00
bergquist
7754c37a1f reduce loglevel to debug 2019-02-19 08:22:33 +01:00
Torkel Ödegaard
9d78960c5e
Merge pull request #15503 from grafana/explore-icon
Updated explore icon and style tweaks
2019-02-18 18:37:51 +01:00
Torkel Ödegaard
df170aee16 Updated explore icon and style tweaks
Lowered icon size and improved paddings, tried to align placement between dashboard and explore
2019-02-18 18:26:24 +01:00
Daniel Lee
56c965e5df cli: chmod 755 for backend plugin binaries
Fixes #15500. Does a simple filename check if the binary names ends
with _linux_amd64 or _darwin_amd64 then sets the file mode to 755.
2019-02-18 15:05:34 +01:00
Torkel Ödegaard
3dae915b23 Bar gauge icon updated 2019-02-16 15:47:35 +01:00
Torkel Ödegaard
1adc1a6097
Merge pull request #15455 from grafana/fixed-handling-of-alert-urls
Fixed handling of alert urls with true flags
2019-02-15 16:27:23 +01:00
Torkel Ödegaard
4c28ec83b3
Merge pull request #15444 from max-neverov/percent_diff_null
Fix percent_diff calculation when points are nulls
2019-02-15 13:03:19 +01:00
Torkel Ödegaard
7699706e65 fixed handling of alert urls with true flags, fixes #15454 2019-02-15 11:23:31 +01:00
Maxim Neverov
28eaac3a9c Extracted common code for diff calculation 2019-02-14 21:52:59 +01:00
Torkel Ödegaard
0256a4dd47
Merge pull request #15417 from kiran3394/master
added support for influxdb non_negative_difference function in tsdb
2019-02-14 18:49:32 +01:00
Torkel Ödegaard
cd8f5835ec
Merge pull request #15395 from briangann/20190212_adjust_notifier_render_timeout
allow 90 percent of alertTimeout for rendering to complete vs 50 percent
2019-02-14 17:21:40 +01:00
Maxim Neverov
3c2f6094b2 Fix percent_diff calculation when points are nulls 2019-02-14 16:31:15 +01:00
Brian Gann
c98b00c302 allow 90 percent of alertTimeout for rendering to complete vs 50 percent 2019-02-13 09:56:37 -06:00
z0029c4
13974cdd28 added support for influxdb non_negative_difference function in tsdb 2019-02-13 18:12:35 +05:30
z0029c4
8cb1e5b918 added support for influxdb non_negative_difference function in tsdb for alerting 2019-02-13 17:55:31 +05:30
Torkel Ödegaard
3b0ae4bd0a
Merge pull request #15368 from grafana/15217-panels-without-queries
POC: Panels without queries can skip DataPanel
2019-02-13 08:06:25 +01:00
Torkel Ödegaard
a1453607a9 Changed noQueries to a dataFormats array that will allow a panel to define supported formats and prefered (first in array) 2019-02-12 16:05:29 +01:00
Carl Bergquist
dcec61e1b4
Merge pull request #15378 from grafana/auth_token_quotas
use authTokenService for session quotas restrictions
2019-02-12 15:38:57 +01:00
bergquist
e163aadfe4 use authtoken for session quota restrictions
closes #15360
2019-02-12 15:10:55 +01:00
bergquist
1310d356fc removes unused session code 2019-02-12 12:33:54 +01:00
Johannes Schill
075fb8e91c chore: Rename isDataPanel to noQueries 2019-02-12 12:28:53 +01:00
Johannes Schill
c4b2dcefbe feat: Introduce IsDataPanel attribute to plugin.json 2019-02-12 12:28:53 +01:00
Daniel Lee
18615a3357
Merge pull request #15363 from bergquist/edition_to_build_info
adds edition to build_info metric
2019-02-11 16:46:53 +01:00
bergquist
e4e42fcd08 adds edition to build_info metric 2019-02-11 15:42:12 +01:00
Daniel Lee
1c364b57b5
Merge pull request #15353 from grafana/14623-azure-monitor-alerting
Adds alerting for the Azure Monitor API in the Azure Monitor datasource
2019-02-11 15:16:32 +01:00
Daniel Lee
ac345312a4 azuremonitor: don't use make for maps and array 2019-02-11 14:42:12 +01:00
Marcus Efraimsson
c13e302cde
Merge pull request #15356 from grafana/15258_fix
revert ds_proxy timeout and implement dataproxy timeout correctly
2019-02-11 14:05:51 +01:00
Marcus Efraimsson
a1cd550df4
revert ds_proxy timeout and implement dataproxy timeout correctly 2019-02-11 13:42:05 +01:00
Carl Bergquist
1f7a1f807e
Merge pull request #15299 from grafana/15295_fux
Make sure alert notifier provisioning directory are created for deb and rpm packages
2019-02-11 13:31:51 +01:00
Daniel Lee
0b74860f55 azuremonitor: fix auto interval calculation on backend
Not needed for alerting (as the query intervalms will always be 0) but needed
later when being called from the frontend)
2019-02-11 13:27:08 +01:00
Daniel Lee
a54484638d interval: make the FormatDuration function public
A useful function that was ported from kbn.ts and can be used
to convert milliseconds into a kbn unit
2019-02-11 11:25:51 +01:00
bergquist
3ce99bca66 renames usage state name for auth token
as noted, sessions might not be a good name for this metrics.
while devices would be a better name for users I think we should
align the name with the code as much as possible. The ui listing
all auth_tokens per user should probarbly say "devices" instead
2019-02-11 11:08:31 +01:00
Carl Bergquist
396a5a947f
Merge pull request #15300 from bergquist/token_usage_stats
adds usage stats for sessions
2019-02-11 10:31:57 +01:00
Marcus Efraimsson
75f89ecf1f
Merge pull request #14888 from bugficks/8570-mysql-ssl-datasource
MySQL SSL CA in datasource connector
2019-02-11 09:00:18 +01:00
Daniel Lee
d6904ba9b4 azuremonitor: small refactoring 2019-02-11 01:22:15 +01:00
Daniel Lee
60327953a2 azuremonitor: handles timegrain set to auto on backend 2019-02-11 01:17:37 +01:00
Daniel Lee
452c4f5b9b azuremonitor: add test for dimension filter 2019-02-10 01:47:38 +01:00
Daniel Lee
b94de101cd azuremonitor: refactor azure monitor api code into own file 2019-02-10 01:18:16 +01:00
Daniel Lee
b816f35c41 azuremonitor: handle multi-dimensions on backend 2019-02-10 00:23:12 +01:00
Daniel Lee
a5e5db20e1 azuremonitor: add support for aggregations on backend 2019-02-09 21:52:44 +01:00
Connor Patterson
d2aed7e075 Fix formatting 2019-02-09 14:13:15 -05:00
Connor Patterson
2987a47a9b Add aws ec2 api metrics for cloudwatch 2019-02-09 13:47:08 -05:00
Daniel Lee
10194df112 azuremonitor: simple alerting for Azure Monitor API
Lots of edge cases and functionality left to implement but
a simple query works for alerting now.
2019-02-08 18:15:17 +01:00
Marcus Efraimsson
1bc2a0af70
use unique datasource id when registering mysql tls config 2019-02-08 18:08:07 +01:00
Daniel Lee
0e228d582d azuremonitor: builds a query and sends it to Azure on the backend
Lots of edge cases not covered and the response is not parsed. It only
handles one service and will have to be refactored to handle multiple
2019-02-08 17:20:31 +01:00
Leonard Gram
b32d420a75 ldap: refactoring. 2019-02-08 08:18:24 +01:00
Daniel Lee
21a1507c77 ldap: fixes #14432. Fix for IPA v4.6.4
IPA v4.6.4 introduced a fix that does not allow empty attributes
to be sent in a search request. This fix only adds attributes to
the request if they are mapped in the ldap toml file.
2019-02-08 08:18:24 +01:00
bergquist
2be60887ca adds usage stats for sessions 2019-02-07 16:27:40 +01:00
Marcus Efraimsson
b4267eafb8
log root cause error when reading from provisioning directories 2019-02-07 15:46:57 +01:00
bergquist
6e7941d396 moves usage stats sender to new package 2019-02-07 14:59:50 +01:00
Marcus Efraimsson
c71904e326
Merge pull request #15239 from grafana/auth_token_middleware_refactor
Auth token package and middleware refactoring
2019-02-07 14:24:23 +01:00
Torkel Ödegaard
78ea7ae783
Merge pull request #15212 from grafana/dashboard-react-page
Dashboard react page
2019-02-07 14:23:44 +01:00
bergquist
170783c292 make hourly cleanup the default behavior 2019-02-07 10:51:35 +01:00
Marcus Efraimsson
1a140ee199
run token cleanup job when grafana starts, then each hour 2019-02-06 22:27:08 +01:00
Marcus Efraimsson
836501186f
fix 2019-02-06 17:30:17 +01:00
Marcus Efraimsson
8ae066ab5d
move authtoken package into auth package 2019-02-06 17:02:57 +01:00
Marcus Efraimsson
8678620730
move UserToken and UserTokenService to models package 2019-02-06 16:55:12 +01:00
Marcus Efraimsson
a60124a88c
change UserToken from interface to struct 2019-02-06 16:30:50 +01:00
Marcus Efraimsson
afa87e6ab4
Merge pull request #15197 from SamuelToh/12546_annotation_nulls_existing_val
Add http patch support for annotations
2019-02-06 14:50:00 +01:00
Marcus Efraimsson
44275d9660
middleware fix 2019-02-06 08:45:01 +01:00
Marcus Efraimsson
d8658a765c
enhanced expiration logic for lookup token
tokens are not expired if created_at > now - LoginMaxLifetimeDays and
rotated_at > now - LoginMaxInactiveLifetimeDays
2019-02-06 08:30:14 +01:00
Marcus Efraimsson
e87ff5a06d
Merge pull request #15265 from larsjoergensen/cloudwatch/add-rds-aurora-serverlessdatabasecapacity-metrics
Added ServerlessDatabaseCapacity metric to list of AWS RDS metrics.
2019-02-05 21:56:11 +01:00
SamuelToh
4de9e3598b Address review comments 2019-02-06 06:41:39 +10:00
Marcus Efraimsson
9483506590
auth token clean up job now runs on schedule and deletes all expired tokens
delete tokens having created_at <= LoginMaxLifetimeDays or
rotated_at <= LoginMaxInactiveLifetimeDays
2019-02-05 21:20:11 +01:00
Marcus Efraimsson
871c84d195
changes needed for api/middleware due to configuration settings 2019-02-05 21:14:23 +01:00
Marcus Efraimsson
0915f931ae
change configuration settings in auth package 2019-02-05 21:12:30 +01:00
Marcus Efraimsson
3c2fd02bc0
refactor login/auth token configuration settings
remove login section and reuse existing sections security and auth
2019-02-05 21:09:55 +01:00
Marcus Efraimsson
1d1b617cee
remove unused code 2019-02-05 21:08:55 +01:00
Lars Jørgensen
749320002b Added ServerlessDatabaseCapacity metric to list of AWS RDS metrics. 2019-02-05 20:57:51 +01:00
jeroenvollenbrock
28aafcd789 cloudwatch: Add tests for resource_arn template query 2019-02-05 18:37:05 +01:00
jeroenvollenbrock
fa977ce090 cloudwatch: Add resource_arns template query function
Implements feature request #8207
2019-02-05 18:37:04 +01:00
Torkel Ödegaard
3d5ca99d53 Merge branch 'dashboard-react-page' of github.com:grafana/grafana into dashboard-react-page 2019-02-05 09:24:14 +01:00
SamuelToh
a7a964ec19 Added PATCH verb end point for annotation op
Added new PATCH verb annotation endpoint

Removed unwanted fmt

Added test cases for PATCH verb annotation endpoint

Fixed formatting issue

Check arr len before proceeding

Updated doc to include PATCH verb annotation endpt
2019-02-05 09:43:17 +10:00
Marcus Efraimsson
d53e64a32c
move auth token middleware/hooks to middleware package
fix/adds auth token middleware tests
2019-02-05 00:21:05 +01:00
Marcus Efraimsson
7cd3cd6cd4
auth package refactoring
moving middleware/hooks away from package
exposing public struct UserToken accessible from other packages
fix debug log lines so the same order and naming are used
2019-02-05 00:10:56 +01:00
Torkel Ödegaard
70974c01f2 Added playlist controls to new react DashNav 2019-02-04 21:08:30 +01:00
Marcus Efraimsson
fb3c510178
Merge branch 'master' into delete_session_on_logout 2019-02-04 20:23:05 +01:00
Torkel Ödegaard
60d7d9c691
Merge pull request #15181 from marefr/fix_ping_unauthorized
auth: /api/login/ping fixes
2019-02-04 18:41:35 +01:00
Marcus Efraimsson
cfd8eb5167
now /api/login/ping returns Response 2019-02-04 17:37:07 +01:00
Marcus Efraimsson
d433ca7d40
fix util for splitting host and port
Now you can provide both a default host and a default port
2019-02-04 13:10:32 +01:00
Connor Patterson
48c8ff8899 Add AWS/Neptune to metricsMap and dimensionsMap 2019-02-03 16:29:35 -05:00
Sean Lafferty
fa22311a95 base64 encode encrypted oauth token fields 2019-02-02 09:03:04 -05:00
Athurg Feng
70b23ab73b Add string quote func 2019-02-02 13:36:10 +08:00
Athurg Feng
bba92c0746 Remove option used to control within browser 2019-02-02 13:35:17 +08:00
Sean Lafferty
4a7cf82f5f Remove length from text columns 2019-02-01 19:45:27 -05:00
Sean Lafferty
5a59cdf0ef Add oauth pass-thru option for datasources 2019-02-01 19:40:57 -05:00
bergquist
a6bd2c73a0 introduce samesite setting for login cookie
ref #15067
2019-02-01 11:47:21 +01:00
bergquist
a1b3986532 always delete session cookie even if db delete fails 2019-02-01 09:59:53 +01:00
Marcus Efraimsson
dd5a8275f1
must return json response from /api/login/ping
Even though http error 401 was returned, the result was still a http 200
2019-02-01 01:21:23 +01:00
bergquist
91bd908e03 adds more tests signing out session 2019-01-31 22:24:04 +01:00
bergquist
11c4967bdc changes some info logging to debug 2019-01-31 21:51:14 +01:00
bergquist
88ca54eba9 renames signout function 2019-01-31 16:26:36 +01:00
bergquist
43ac79685a delete auth token on signout 2019-01-31 16:13:35 +01:00
Carl Bergquist
e2c2b70a61
Merge pull request #14852 from jpenalbae/pushover-attach
pushover: add support for attaching images (closes #10780)
2019-01-31 11:18:08 +01:00
Daniel Lee
782c4eae98
Merge pull request #15127 from challengerdeep/fix-stackdriver-aggparams-reducer
Change primaryAggregation to crossSeriesReducer in Stackdriver
2019-01-30 00:45:22 +01:00
Torkel Ödegaard
9a598be4f7 Fixed failing unit test 2019-01-29 21:17:56 +01:00
Torkel Ödegaard
416562bd90
Merge pull request #15102 from mjtrangoni/fix-golint-issues
Fix golint issues
2019-01-29 21:12:34 +01:00
Torkel Ödegaard
a2dd6f378f fixed sqlite issue introduced by #14709 2019-01-29 20:27:01 +01:00
Marcus Efraimsson
a067862a0a
Merge pull request #14709 from tpetr/extra-connection-string-args
add support for defining additonal database connection string args
2019-01-29 20:13:17 +01:00
Robert Edström
9b6746d808 Change primaryAggregation to crossSeriesReducer in Stackdriver 2019-01-29 19:11:54 +01:00
Daniel Lee
a3e09d8bbc azuremonitor: fixes merge conflict in yarn.lock 2019-01-29 15:35:43 +01:00
Carl Bergquist
c6f80ecec2
Merge pull request #14229 from pbakulev/configurable-alert-notification
Configurable alert notification
2019-01-28 22:47:12 +01:00
Mario Trangoni
b7628f2060 pkg/util/{filepath.go,shortid_generator.go}: Fix golint issues
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
filepath.go:12:5⚠️ error var WalkSkipDir should have name of the form ErrFoo (golint)
shortid_generator.go:11:5⚠️ var validUidPattern should be validUIDPattern (golint)
shortid_generator.go:19:6⚠️ func IsValidShortUid should be IsValidShortUID (golint)
shortid_generator.go:24:6⚠️ func GenerateShortUid should be GenerateShortUID (golint)
2019-01-28 22:37:44 +01:00
Mario Trangoni
8261613b51 pkg/util/{ip.go,url.go}: Fix some golint issues
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
ip.go:8:6⚠️ func SplitIpPort should be SplitIPPort (golint)
url.go:14:6⚠️ func NewUrlQueryReader should be NewURLQueryReader (golint)
url.go:9:6⚠️ type UrlQueryReader should be URLQueryReader (golint)
url.go:37:6⚠️ func JoinUrlFragments should be JoinURLFragments (golint)
2019-01-28 22:29:20 +01:00
Mario Trangoni
5f6383a750 pkg/util/*: Add missing function comments.
See,

$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
encoding.go:15:1⚠️ comment on exported function GetRandomString should be of the form "GetRandomString ..." (golint)
encoding.go:30:1⚠️ exported function EncodePassword should have comment or be unexported (golint)
encoding.go:35:1⚠️ comment on exported function EncodeMd5 should be of the form "EncodeMd5 ..." (golint)
encoding.go:42:1⚠️ comment on exported function PBKDF2 should be of the form "PBKDF2 ..." (golint)
encoding.go:80:1⚠️ exported function GetBasicAuthHeader should have comment or be unexported (golint)
encoding.go:85:1⚠️ exported function DecodeBasicAuthHeader should have comment or be unexported (golint)
encoding.go:105:1⚠️ exported function RandomHex should have comment or be unexported (golint)
encryption.go:14:1⚠️ exported function Decrypt should have comment or be unexported (golint)
encryption.go:39:1⚠️ exported function Encrypt should have comment or be unexported (golint)
ip.go:7:1⚠️ exported function SplitIpPort should have comment or be unexported (golint)
json.go:3:6⚠️ exported type DynMap should have comment or be unexported (golint)
md5.go:22:1⚠️ comment on exported function Md5SumString should be of the form "Md5SumString ..." (golint)
strings.go:10:1⚠️ exported function StringsFallback2 should have comment or be unexported (golint)
strings.go:14:1⚠️ exported function StringsFallback3 should have comment or be unexported (golint)
strings.go:27:1⚠️ exported function SplitString should have comment or be unexported (golint)
strings.go:35:1⚠️ exported function GetAgeString should have comment or be unexported (golint)
url.go:8:6⚠️ exported type UrlQueryReader should have comment or be unexported (golint)
url.go:12:1⚠️ exported function NewUrlQueryReader should have comment or be unexported (golint)
url.go:23:1⚠️ exported method UrlQueryReader.Get should have comment or be unexported (golint)
url.go:32:1⚠️ exported function JoinUrlFragments should have comment or be unexported (golint)
validation.go:16:1⚠️ exported function IsEmail should have comment or be unexported (golint)
2019-01-28 22:09:40 +01:00
bergquist
e218cc7637 docs: updates docs to refer to using uid 2019-01-28 22:03:16 +01:00
bergquist
7c93335d28 gofmt issue 2019-01-28 21:04:08 +01:00
bergquist
809019d4ee moves test files into testdata folder 2019-01-28 20:44:10 +01:00
bergquist
8f0e65a150 renames alert_notifications -> notifiers 2019-01-28 20:39:09 +01:00
Marcus Efraimsson
7023c957d7
Merge branch 'master' into nanosecond-postgresql 2019-01-28 20:04:46 +01:00
Marcus Efraimsson
f157c19e16
extract parsing of datasource tls config to method 2019-01-28 19:38:56 +01:00
Daniel Lee
e4f4cb814c Merge branch 'master' into azure-monitor 2019-01-28 19:23:34 +01:00
Marcus Efraimsson
ed6cca61c9
Merge pull request #15051 from ellisvlad/13711_parse_database_config_ipv6_host
Parse database host correctly when using IPv6
2019-01-28 18:32:09 +01:00
Marcus Efraimsson
f701c610fb
Merge pull request #15054 from RangerRick/master
add global datasource proxy timeout setting
2019-01-28 18:21:27 +01:00
Torkel Ödegaard
50b140f6ce
Merge pull request #15082 from bergquist/explore_by_default
enables explore by default
2019-01-28 17:09:17 +01:00
bergquist
21fff415ed removes unnessecary db request 2019-01-28 15:37:52 +01:00
bergquist
935da14f7d tab/spaces formatting 2019-01-28 15:27:02 +01:00
Marcus Efraimsson
6584ca20d2
Merge branch 'master' into 8570-mysql-ssl-datasource 2019-01-28 15:12:33 +01:00
Torkel Ödegaard
2dc2471b5c Revert "Updated home dashboard, removed home dashboard header"
This reverts commit 0151846e1e.
2019-01-28 15:01:42 +01:00
bergquist
6a8643b3d1 Merge branch 'master' into configurable-alert-notification
* master: (250 commits)
  Firing off an action instead of listening to location changes
  Changes after PR Comments
  Made ExplorerToolbar connected and refactored away responsabilities from Explore
  Removed some split complexity
  Fixed some more styling
  Fixed close split look and feel
  Fixed position of Closesplit
  Fixed small issue with TimePicker dropdown position
  Simplified some styles and dom elements
  Fixed some more with the sidemenu open and smaller screens
  Fixed so heading looks good with closed sidemenu
  Restructure of component and styling
  Refactored out ExploreToolbar from Explore
  Fixed reinitialise of Explore
  changelog: add notes about closing #13929
  changelog: add notes about closing #14558
  changelog: add notes about closing #14484
  changelog: add notes about closing #13765
  changelog: add notes about closing #11503
  changelog: add notes about closing #4075
  ...
2019-01-28 14:16:43 +01:00
bergquist
6e672eb291 enable explore by default
closes #15037
2019-01-28 13:02:54 +01:00
bergquist
0cbc89b063 Merge branch 'master' into 14701-fix-alert-context
* master: (262 commits)
  pkg/services/dashboards/dashboard_service.go: simplify return
  Updated url query param encoding to exctly match angular encoding
  Updated snapshot
  Added missing props not being passed to scrollbar component, fixes #15058
  Document /api/health
  changelog: adds note for #15062
  change default rotate_token_minutes to 10 minutes
  fix
  load test/ha fixes
  set low login cookie rotate time in ha mode
  fix multiple piechart instances bug
  scripts/build/*: Fix some golint issues
  scripts/build/*: Fix golint issues Url => URL
  build: fixes building grafana completely within docker.
  dont specify domain for auth cookies
  New snapshot reflecting changes
  Makes the clickable side menu header look great in light theme again
  org id fix for load test
  user auth token load tests using k6.io
  moves cookie https setting to [security]
  ...
2019-01-28 08:09:52 +01:00
bergquist
364154d81f moves timeout tests to an integration test 2019-01-28 07:56:31 +01:00
Vlad Ellis
9692955d4f
Correct formatting of sqlstore_test.go 2019-01-27 16:28:02 +00:00
Mario Trangoni
bf90ff87cf pkg/services/dashboards/dashboard_service.go: simplify return
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck  ./...
pkg/services/dashboards/dashboard_service.go:167:2⚠️ 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013) (megacheck)
2019-01-26 14:23:10 +01:00
Vlad Ellis
c208186f26 Parse database host correctly when using IPv6 2019-01-25 21:56:19 +00:00
Marcus Efraimsson
e4924795a2
change default rotate_token_minutes to 10 minutes 2019-01-25 13:30:26 +01:00
bergquist
75760aa892 dont specify domain for auth cookies 2019-01-25 10:40:50 +01:00
bergquist
b5572b23b6 Merge branch 'master' into poc_token_auth
* master: (32 commits)
  Fixed react key warning for loki start page
  Disable query should trigger refresh
  added docs entry for check_for_updates config flag, fixes ##14940
  Explore: Fix scanning for logs
  Moved ad hoc filters and upload directive
  Moved dashboard srv and snapshot ctrl
  Moved share modal
  Moved dashboard save modals to components folder
  Moved unsaved changes service and modal
  Removed unused alertingSrv
  Moved view state srv to services
  Moved timepicker to components
  Moved submenu into components dir
  Moved dashboard settings to components
  Moved dashboard permissions into components dir
  Moved history component, added start draft of frontend code style guide
  fix: Use custom whitelist for XSS sanitizer to allow class and style attributes
  Began work on improving structure and organization of components under features/dashboard, #14062
  Fix a typo in changelog
  Update ROADMAP.md
  ...
2019-01-25 08:28:24 +01:00
Benjamin Reed
9108fd1b9d add global datasource proxy timeout setting
closes grafana#5699
2019-01-24 14:06:48 -05:00
bergquist
d6edaa1328 moves cookie https setting to [security] 2019-01-24 19:04:58 +01:00
bergquist
9153b6ed96 improves readability of loginping handler 2019-01-24 15:17:09 +01:00
bergquist
516037fbdd makes sure rotation is always higher than urgent rotation 2019-01-24 13:54:45 +01:00
bergquist
9ae306e417 use defer to make sure we always release session data 2019-01-24 13:48:36 +01:00
bergquist
fd0f9f2dd2 fixes broken test 2019-01-24 12:06:44 +01:00
bergquist
f257101c41 removes unused/commented code 2019-01-24 11:26:45 +01:00
bergquist
ff483f3782 removes old cookie auth configuration 2019-01-24 10:55:10 +01:00
bergquist
56a521b264 makes auth token rotation time configurable 2019-01-24 10:50:18 +01:00
bergquist
4626f083bb store oauth login error messages in an encrypted cookie 2019-01-23 17:01:09 +01:00
bergquist
df85cc9bb1 redirect logged in users from /login to home 2019-01-23 15:28:33 +01:00