Commit Graph

56 Commits

Author SHA1 Message Date
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
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
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
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
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
bergquist
e163aadfe4 use authtoken for session quota restrictions
closes #15360
2019-02-12 15:10:55 +01:00
Marcus Efraimsson
8678620730
move UserToken and UserTokenService to models package 2019-02-06 16:55:12 +01: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
bergquist
9ae306e417 use defer to make sure we always release session data 2019-01-24 13:48:36 +01:00
bergquist
5998646da5 restrict session usage to auth_proxy 2019-01-23 14:56:48 +01:00
Marcus Efraimsson
4096449aec
extract auth token interface and remove auth token from context 2019-01-22 12:00:33 +01:00
bergquist
aba6148c43 login users based on token cookie 2019-01-16 16:44:40 +01:00
Marcus Efraimsson
8764fb5aa6
inject login/logout hooks 2019-01-15 15:16:20 +01:00
Bob Shannon
16ff8a182b Re-organize packages and add basic auth test 2018-11-19 13:54:13 -05:00
Bob Shannon
dcc48860b8 Fix formatting and remove enabled toggle 2018-11-14 17:37:32 -05:00
Bob Shannon
362b3740ed Add basic authentication support to metrics endpoint 2018-11-14 16:27:41 -05:00
Marcus Efraimsson
cfb061ddab
refactor datasource caching 2018-10-30 09:31:56 +01:00
Torkel Ödegaard
8c9939df72 Adds backend hooks service so extensions can modify index data 2018-10-12 11:26:42 +02:00
bergquist
bff350166e disabling internal metrics disables /metric endpoint
but we will still keep sending metrics to graphite

closes #10638
2018-09-13 16:09:52 +02:00
Torkel Ödegaard
10e86eda69
fix: #12461 introduced issues with route registration ordering, adding plugin static routes before plugins package had been initiated (#12474) 2018-07-01 23:35:50 -07:00
Carl Bergquist
861af4cb97 Improve extensions build. (#12461)
* enable ee build on pr/master

* step1: of including group sync

* disable commit pinning for now

* fixes broken build

* enable team to ldap group sync

* avoid returning error for missing external handler

* services: allow routes to be added before http server start

* services: allows services to add their own migrations

* moves db migrations to ee code base

* build using master branch in ee

* disable enterprise build in .bra.toml

[skip ci]

* removes team sync extensions

* removes commented line
2018-07-01 07:01:43 -07:00
bergquist
dbfafa1cb5 routing: allows routes to be added to existing groups
this enables services to add routing to ex /api
without causing conflicts.
2018-06-25 16:50:27 +02:00
Torkel Ödegaard
80d694d205
Backend image rendering as plugin (#11966)
* rendering: headless chrome progress

* renderer: minor change

* grpc: version hell

* updated grpc libs

* wip: minor progess

* rendering: new image rendering plugin is starting to work

* feat: now phantomjs works as well and updated alerting to use new rendering service

* refactor: renamed renderer package and service to rendering to make renderer name less confusing (rendering is internal service that handles the renderer plugin now)

* rendering: now render key is passed and render auth is working in plugin mode

* removed unneeded lines from gitignore

* rendering: now plugin mode supports waiting for all panels to complete rendering

* fix: LastSeenAt fix for render calls, was not set which causes a lot of updates to Last Seen at during rendering, this should fix sqlite db locked issues in seen in previous releases

* change: changed render tz url parameter to use proper timezone name as chrome does not handle UTC offset TZ values

* fix: another update to tz param generation

* renderer: added http mode to renderer service, new ini setting [rendering] server_url
2018-05-24 15:26:27 +02:00
Thibaut Patel
bdb736a9ee http_server: All files in public/build have now a huge max-age (#11536) 2018-05-08 13:54:00 +02:00
Torkel Ödegaard
23655315b8 fix: fixed race condition between http.Server ListenAndServe & Shutdown, now service crash during startup correctly closes http server every time 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
d04ad835e2 refactoring: lots of refactoring around server shutdown flows, making sure process is terminated when background service has crashed 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
053c2039bb refactor: provisioning service refactoring 2018-05-02 19:56:15 +02:00
Torkel Ödegaard
13e015fe3f fix: improved handling of http server shutdown 2018-05-01 14:14:11 +02:00
Torkel Ödegaard
fa7d7ed5df
Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
2018-04-30 16:21:04 +02:00
Carl Bergquist
28f7b6dad1 Enable Grafana extensions at build time. (#11752)
* extensions: import and build

* bus: use predefined error

* enterprise: build script for enterprise packages

* poc: auto registering services and dependency injection

(cherry picked from commit b5b1ef875f905473af41e49f8071cb9028edc845)

* poc: backend services registry progress

(cherry picked from commit 97be69725881241bfbf1e7adf0e66801d6b0af3d)

* poc: minor update

(cherry picked from commit 03d7a6888b81403f458b94305792e075568f0794)

* ioc: introduce manuel ioc

* enterprise: adds setting for enterprise

* build: test and build specific ee commit

* cleanup: test testing code

* removes example hello service
2018-04-27 13:41:58 +02:00
Karsten Weiss
4d87cb03c5 Simplify make() (gosimple)
This fixes:
pkg/api/http_server.go:142:89: should use make(map[string]func(*http.Server, *tls.Conn, http.Handler)) instead (S1019)
pkg/services/alerting/scheduler.go:18:30: should use make(map[int64]*Job) instead (S1019)
pkg/services/alerting/scheduler.go:26:31: should use make(map[int64]*Job) instead (S1019)
2018-04-16 21:04:57 +02:00
Julian Kornberger
6f363153d7 Adjust permissions of unix socket
fixes #8358
2018-03-23 16:09:04 +01:00
Julian Kornberger
0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Daniel Lee
3ca1e06509 session: fork Macaron mysql session middleware
This changes forks the mysql part of the Macaron session middleware.

In the forked mysql file:

- takes in a config setting for SetConnMaxLifetime (this solves wait_timeout
problem if it is set to a shorter interval than wait_timeout)
- removes the panic when an error is returned in the Exist function.
- retries the exist query once
- retries the GC query once
2018-03-16 01:19:28 +01:00
Martin Szulecki
c82e23d96e imguploader: Add support for new internal image store (#6922) 2018-01-12 21:40:12 +01:00
bergquist
f7ed24475c wait for all sub routines to finish
simple solution for waiting for all go sub routines to
finish before closing Grafana. We would use errGroup
here as well but I dont like spreading context's all
over the place.

closes #10131
2017-12-11 08:53:06 +01:00
bergquist
3a772c7f7f allows head requests for /api/health endpoint
closes #9955
2017-11-21 15:03:04 +01:00
Daniel Lee
0d85c63fff middleware: recovery handles panics in all handlers
Also, changes the order of the middleware so that recovery is after the
gzip middleware. Otherwise, a 200 OK is returned instead of a 500 error.
2017-11-15 13:57:33 +01:00
bergquist
139f077453 prometheus: enable gzip for /metrics endpoint
closes #9464
2017-10-23 09:35:46 +02:00
bergquist
b5727949fd logging: dont use cli logger in http_server 2017-10-12 15:29:01 +02:00
Carl Bergquist
ee5f69beb4 metrics: disable gzip for /metrics endpoint (#9468)
Prometheus client lib support gzip by itself. Which caused the
response to be double gzipped sometimes. We should use the Grafana
middle ware instead.

closes #9464
2017-10-12 12:02:36 +02:00
bergquist
4bc6ecb241 adds metric middlware to route register 2017-09-14 14:26:32 +02:00
bergquist
6d22a67a30 return /metrics before session middleware 2017-09-14 14:26:32 +02:00
Torkel Ödegaard
4f9fbcc211 dataproxy: added caching of datasources when doing data proxy requests, #9078 2017-08-23 13:31:26 +02:00
Daniel Lee
74093c700f api: adds no-cache header for GET requests
Fixes #5356. Internet Explorer aggressively caches GET requests which
means that all API calls fetching data are cached. This fix adds a
Cache-Control header with the value no-cache to all GET requests to
the API.
2017-07-04 21:26:05 +02:00
Daniel Lee
0eb297822c httpserver: fixes #8641
Changes to the http_server class meant that the TLS settings were not
getting applied anymore. This fixes so that the minimum TLS version is
1.2 again.
2017-06-17 23:10:12 +02:00
Daniel Lee
4a35126bf6 api: health check returns 503 if db is failing
ref #3302
2017-05-10 15:23:59 +02:00
Mitja Z
c92d719a72 added support for listening on unix socket #4030 (#8221) 2017-04-27 08:54:21 +02:00
Torkel Ödegaard
19a04b7e4a change: minor change to health check api endpoint 2017-04-25 17:24:36 +02:00