Arve Knudsen
294770f411
Chore: Handle wrapped errors ( #29223 )
...
* Chore: Handle wrapped errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 13:34:28 +01:00
Arve Knudsen
52c154a221
Backend: Rename variables for style conformance ( #29097 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 17:09:14 +01:00
Carl Bergquist
e3c7d66324
Tracing: Add setting for sampling server ( #29011 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-11 10:21:52 +01:00
Arve Knudsen
b5379c5335
Chore: Fix SQL related Go variable naming ( #28887 )
...
* Chore: Fix variable naming
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-11 06:21:08 +01:00
Arve Knudsen
3d3a7cbba8
Chore: Fix staticcheck issues ( #28860 )
...
* Chore: Fix issues reported by staticcheck
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Undo changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix issues reported by staticcheck
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 13:07:06 +01:00
Arve Knudsen
dff84f6a31
Chore: Remove dead code ( #28664 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 11:00:00 +01:00
Arve Knudsen
ec40e49dcb
Chore: Rewrite some tests to use testify ( #28420 )
...
* Chore: Improve tests to use testify
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-21 10:09:42 +02:00
Carl Bergquist
89ebb97fca
Instrumentation: Adds environment_info metric ( #28355 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-19 16:58:16 +02:00
Marcus Efraimsson
747513d444
Plugins: Fix loading of backend plugins ( #27951 )
...
Ref #27921
2020-10-01 10:39:42 +02:00
Carl Bergquist
7b891d10ee
Instrumentation: Removes invalid chars from label names ( #27921 )
2020-09-30 20:12:57 +02:00
Arve Knudsen
a5d9196a53
Chore/fix lint issues ( #27704 )
...
* Chore: Fix linting issues
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-22 16:22:19 +02:00
Dan Cech
53153c82fc
add method to get usage report ( #27555 )
2020-09-15 09:01:15 -04:00
Emil Tullstedt
b68634fbb4
Tests: Batch of GoConvey to Testify conversions ( #27008 )
2020-08-14 14:43:25 +02:00
Arve Knudsen
e6e5cc6e80
Chore: Simplify generic OAuth code ( #26779 )
...
* Generic OAuth: Simplify
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Rename test variables for consistency
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-04 18:28:53 +02:00
Arve Knudsen
415638cdda
Chore: Use interfaces where possible ( #26392 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-23 08:17:20 +02:00
Arve Knudsen
4c56eb3991
Chore: Enable goprintffuncname and nakedret linters ( #26376 )
...
* Chore: Enable goprintffuncname linter
* Chore: Enable nakedret linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-23 08:14:39 +02:00
Arve Knudsen
d4e4cb4c71
Chore: Enable Go linter gocritic ( #26224 )
...
* Chore: Enable gocritic linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-16 14:39:01 +02:00
Arve Knudsen
41d432b5ae
Chore: Enable whitespace linter ( #25903 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
Carl Bergquist
26852ca788
Instrument dashboard versions and annotation count ( #26044 )
2020-07-03 15:47:46 +02:00
Arve Knudsen
5070f7a75b
Chore: Start harmonizing linting with plugin SDK ( #25854 )
...
* Chore: Harmonize linting with plugin SDK
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix linting issues
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 14:08:32 +02:00
Arve Knudsen
07582a8e85
Chore: Fix various spelling errors in back-end code ( #25241 )
...
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
Dan Cech
66b7398fb6
expose metrics for the number of configured datasources ( #24267 )
2020-05-06 11:36:18 -04:00
Arve Knudsen
96ffcaa134
Plugins: Require signing of external back-end plugins ( #24075 )
...
* PluginManager: Require signing of external plugins
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-05-04 10:57:55 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues ( #23905 )
...
* Fix misspell issues
See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* Fix codespell issues
See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* ci please?
* non-empty commit - ci?
* Trigger build
Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Alexander Zobnin
fa710a3172
Rendering: Add metrics ( #23827 )
...
* Rendering: base metrics
* Rendering: rendering_queue_size metric
* Chore: fix linter error
* Rendering metrics: refactoring
* Apply suggestions from code review
Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Rendering metrics: handle DeadlineExceeded errors
* Rendering metrics: don't measure canceled request time
* Rendering metrics: revert deleting summary for canceled requests
* Update pkg/services/rendering/rendering.go
Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Rendering: return ErrTimeout if context deadline exceeded
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-04-27 15:29:46 +03:00
Carl Bergquist
a08cbbcc81
Instrument backend plugin requests ( #23346 )
2020-04-09 14:47:46 +02:00
Carl Bergquist
15bff3114f
Usagestats: Add usage stats about what type of datasource is used in alerting. ( #23125 )
2020-04-02 08:45:04 +02:00
twendt
ff6a082e23
Auth: Azure AD OAuth ( #20030 )
...
* Implement Azure AD oauth
* Use go-jose and cleanup
* Update go-jose in go.mod
* cleanup
* Add unit tests
* Fix scopes
* Add documentation page
* Improve documentation
* Convert extract_role into function.
* Do not use upn and replace unique_name with preferred_username
* Configure login button
* Use official microsoft icon and color from branding guideline.
* Add Azure AD config section in sample.ini.
2020-02-13 12:12:25 +03:00
Mark Carey
28230bbf52
Metrics: Adds back missing summary quantiles ( #21858 )
...
Adds back missing summary quantiles which was mistakenly
removed in v6.6.0.
Fixes #21857
2020-02-05 11:11:14 +01:00
Emil Tullstedt
29687903f8
Admin: Add promotional page for Grafana Enterprise ( #21422 )
...
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-01-15 14:50:44 +01:00
Marcus Efraimsson
5c711bfb79
Backend Plugins: Collect and expose metrics and plugin process health check ( #21481 )
...
Adds support for collecting metrics from backend plugins and
exposing them thru Grafana's Prometheus metrics endpoint.
Enables to check health of backend plugin by using the route
`/api/plugins/<plugin id>/health`.
Uses sdk v0.6.0.
Closes #20984
2020-01-15 13:10:48 +01:00
Dave Henderson
66b70b50b8
Tracing: Support configuring Jaeger client from environment ( #21103 )
...
* Tracing: Support configuring Jaeger client from environment
* Tracing: Replace deprecated Jaeger Client call
2019-12-18 20:09:15 +01:00
Arve Knudsen
b1af28122b
Server: Fail when unable to create log directory ( #20804 )
2019-12-02 15:40:32 +01:00
Jon Gyllenswärd
bccc5397f6
Instrumentation: Edition and license info to usage stats ( #20589 )
...
* Added edition and licensing info to usage stats
2019-11-22 12:19:00 +01:00
Leonard Gram
992b4b8adf
Licensing service ( #19903 )
...
* Licensing: supplies a service to handle licensing information
* Licensing: uses the license service further
Uses the license service instead of settings.isEnterprise:
- external team members
- saml
- usage stats
* Licensing: fixes broken tests due to new Licensing service dependency
* Licensing: fixes linting errors
* Licensing: exposes license expiry information to the frontend
2019-11-01 14:56:12 +01:00
Arve Knudsen
7349a6b96c
pkg/infra: Check errors ( #19705 )
...
* pkg/infra: Check errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* pkg/infra: Handle errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Update pkg/infra/usagestats/usage_stats.go
Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2019-10-10 16:42:11 +02:00
Marcus Efraimsson
80592e3361
Metrics: Adds setting for turning off total stats metrics ( #19142 )
...
Don't update total stats metrics if reporting is disabled.
New setting disable_total_stats for turning off update
of total stats (stat_totals_*) metrics.
Ref #19137
2019-09-17 09:32:24 +02:00
Kyle Brandt
f689b60426
remotecache: support SSL with redis ( #18511 )
...
* update go-redis lib from v2 -> v5
* add ssl option to the redis connection string
fixes #18498
2019-08-13 06:51:13 -04:00
Dima Kurguzov
a4b0ccc138
Instrumentation: Add failed notifications metric ( #18089 )
2019-07-24 11:43:24 +02:00
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
Alexander Zobnin
214195441f
SAML: add metrics ( #18194 )
2019-07-19 15:30:31 +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
09eb9a45ce
Metrics: add LDAP active sync summary metric ( #18079 )
2019-07-15 08:33:48 +03:00
Kyle Brandt
0adbb001db
RemoteCache: redis connection string parsing test ( #17702 )
2019-06-24 11:51:38 +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
Carl Bergquist
6809d2bb29
codestyle: moves cache to infra ( #17519 )
2019-06-13 10:55:38 +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
Carl Bergquist
1aadb4426a
metrics: expose stats about roles as metrics ( #17469 )
2019-06-06 16:39:35 +02:00
Jonathan Rockway
02975256d1
Tracing: allow propagation with Zipkin headers ( #17009 )
...
Closes #17006
2019-06-05 13:12:05 +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
Oleg Gaidarenko
9b7f9dd9be
LDAP: consistently name the LDAP entities ( #17203 )
2019-05-22 15:30:03 +03: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
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
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
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
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
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
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
Oleg Gaidarenko
c5bc723a6e
Correct table names of sql storage for remotecache
2019-03-20 13:24:56 +01:00
bergquist
6d42d43b22
use constants for cache type
2019-03-14 15:48:20 +01: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
bergquist
7aeab0a235
use Get
instead of Find
2019-03-11 11:04:56 +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
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
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
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
bergquist
8a3a3cccc3
moves metric package to /infra
...
ref #14679
2019-02-24 21:12: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
bergquist
2be60887ca
adds usage stats for sessions
2019-02-07 16:27:40 +01:00
bergquist
6e7941d396
moves usage stats sender to new package
2019-02-07 14:59:50 +01:00
bergquist
7aa84aeb61
moves migrations to /sqlstore/migrations
2018-12-17 16:36:57 +01:00
bergquist
dbcc2e868d
adds integration tests to ci build
2018-12-17 16:36:57 +01:00
bergquist
11cde7ed71
renames main lock function
2018-12-17 16:36:57 +01:00
bergquist
c565b018c5
clean up integration tests
2018-12-17 16:36:57 +01:00
bergquist
823bba8d98
change from db_text to nvarchar
2018-12-17 16:36:57 +01:00
bergquist
dc49bebb00
adds server lock package
2018-12-17 16:36:57 +01:00