Commit Graph

94 Commits

Author SHA1 Message Date
idafurjes
6c5a573772
Chore: Move ReqContext to contexthandler service (#62102)
* Chore: Move ReqContext to contexthandler service

* Rename package to contextmodel

* Generate ngalert files

* Remove unused imports
2023-01-27 08:50:36 +01:00
Sofia Papagiannaki
7ba076de10
Chore: Move swagger definitions to the handlers (#52643) 2022-07-27 09:54:37 -04:00
Sofia Papagiannaki
3e752a0db1
Alerting: modify alertmanager endpoints for proxying using the datasource UID (#47978)
* Alerting: enable proxying alertmanager calls using the datasource UID

* Remove use of datasource ID from the API

* Update frontend
2022-04-29 10:25:22 +03:00
Sofia Papagiannaki
c8189e4808
API: enable proxying datasource calls using the datasource UID (#47634)
* Introduce additional routes
2022-04-14 13:28:13 +03:00
Owen Diehl
36614b03f7
Data Source Proxy: Migrate proxy to its own service and make more extensible (#31927)
* datasource proxy extensions

* revert normalresponse extensions

* data proxy service impl

* lint

* api datasource proxy method

* moves datasource proxy tests into correct new pkg
2021-03-17 13:10:40 -04:00
Arve Knudsen
87c3a2b790
PluginManager: Make Plugins, Renderer and DataSources non-global (#31866)
* PluginManager: Make Plugins and DataSources non-global

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

* Fix integration tests

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

* Replace outdated command

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

* DashboardService: Ensure it gets constructed with necessary parameters

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

* Fix build

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

* DashboardService: Ensure it gets constructed with necessary parameters

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

* Remove dead code

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>

* Remove FocusConvey

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

* Fix test

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

* Remove dead code

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

* Undo interface changes

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

* Backend: Move tsdbifaces.RequestHandler to plugins.DataRequestHandler

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

* Rename to DataSourceCount

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

* Consolidate dashboard interfaces into one

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

* Fix tests

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

* Fix tests

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

* Fix test

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

* Fix tests

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

* Fix tests

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

* Fix tests

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

* Fix tests

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

* Fix dashboard integration tests

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-17 16:06:10 +01:00
Marcus Efraimsson
c0edf88f9f
Data proxy: Fix encoded characters in URL path should be proxied encoded (#30597)
Fix encoded characters in URL path should be proxied as encoded in the data proxy.

Fixes #26870 
Fixes #31438

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-17 12:17:41 +01:00
Arve Knudsen
b79e61656a
Introduce TSDB service (#31520)
* Introduce TSDB service

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

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2021-03-08 07:02:49 +01:00
Joan López de la Franca Beltran
6415d2802e
Plugins: Requests validator (#30445)
* Introduce PluginRequestValidator abstraction with a NoOp implementation

* Update PluginRequestValidator abstraction to use the dsURL instead

* Inject PluginRequestValidator into the HTTPServer and validate requests going through data source proxy

* Inject PluginRequestValidator into the BackendPluginManager and validate requests going through it

* Validate requests going through QueryMetrics & QueryMetricsV2

* Validate BackendPluginManager health requests

* Fix backend plugins manager tests

* Validate requests going through alerting service

* Fix tests

* fix tests

* goimports

Co-authored-by: Leonard Gram <leo@xlson.com>
2021-02-03 20:47:45 +01:00
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
164242f5fd
Data sources: Don't fail if URL doesn't specify protocol (#24497) 2020-05-12 13:04:18 +02:00
Arve Knudsen
7d88018531
DataSourceProxy: Handle URL parsing error (#23731)
* pluginproxy: Handle URL parsing error
* pkg/api: Validate data source URLs
* pkg/api: Return 400 for URL validation error
2020-04-22 10:30:06 +02:00
Carl Bergquist
3fdd2648b1
Chore: Avoid aliasing importing models in api package (#22492) 2020-03-04 12:57:20 +01: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
Andrej Ocenas
bbdc1c0e64 Add custom header with grafana user and a config switch for it 2019-03-14 16:33:19 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Marcus Efraimsson
52d825f535
log error on datasource access denied 2018-10-30 09:32:32 +01:00
Marcus Efraimsson
cfb061ddab
refactor datasource caching 2018-10-30 09:31:56 +01:00
Leonard Gram
97a3a4f33a removes debug log. 2018-10-12 15:13:55 +02:00
Leonard Gram
d360d8cebc Requests for ds via backend blocked for users without permissions. 2018-10-11 13:52:23 +02:00
Marcus Efraimsson
3fa8088192
dataproxy should forward a trailing slash to proxy 2018-10-03 12:55:01 +02:00
ryan
b4fad40c5a Merge remote-tracking branch 'grafana/master' into proxy-slash
* grafana/master: (127 commits)
  alerting: move all notification conditions to defaultShouldNotify
  filter NULL values for column value suggestions
  imguploader: Add support for ECS credential provider for S3
  Remove .dropdown-menu-open on body click fixes #13409
  Remove option r from ln command since its not working everywhere
  fix: updated tests
  Fix spelling of your and you're
  Changed setting to be an alerting setting
  Remove non-existing css prop
  fix: Legend to the right, as table, should follow the width prop. Removing css conflicting with baron's width calculation. #13312
  rendering: Added concurrent rendering limits
  devenv: fix uid for bulk alert dashboards
  Explore: moved code to app/features/explore
  target gfdev-prometheus datasource
  devenv: adds script for creating many dashboards with alerts
  Fix goconst issues
  When stacking graphs, always include the y-offset so that tooltips can render proper values for individual points
  provisioning: changed provisioning default update interval from 3 to 10 seconds
  Fix https://github.com/grafana/grafana/issues/13387 metric segment options displays after blur
  docs: improve oauth generic azure ad instructions
  ...
2018-09-26 20:24:08 -07:00
Ryan McKinley
7168190f7a make sure we don't add the slash twice 2018-09-19 10:02:04 -07:00
Ryan McKinley
bc68aa99b2 add the trailing slash 2018-09-18 11:16:09 -07:00
Torkel Ödegaard
0e9a6dcedc Use datasource cache for backend tsdb/query endpoint (#13266)
fix: use datasource cache for backend datasources
2018-09-14 09:30:32 +02: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
Dan Cech
c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
Torkel Ödegaard
4f9fbcc211 dataproxy: added caching of datasources when doing data proxy requests, #9078 2017-08-23 13:31:26 +02:00
Torkel Ödegaard
8bf49c51b9 dataproxy: refactoring data source proxy to support route templates and wrote more tests for data proxy code, #9078 2017-08-23 10:52:31 +02:00
Torkel Ödegaard
63d6ab476a feat: data source proxy refactoring and route handling, #9078 2017-08-22 17:14:15 +02:00
Dan Cech
007c08f2a8 remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests (#8418)
* remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests

* properly handle X-Forwarded-For
2017-05-24 13:39:40 +02:00
Torkel Ödegaard
1cd632cc43 plugins: added state property to plugins 2017-04-07 12:00:03 +02:00
Torkel Ödegaard
6965064ea9 Merge branch 'master' into sql-proxy 2017-03-29 16:40:14 +02:00
bergquist
9ece10ef24 style(dataproxy): simplify expression 2017-02-07 11:03:57 +01:00
Mitsuhiro Tanda
69566a23fc improve security of Prometheus datasource 2017-02-06 23:10:10 +09:00
Torkel Ödegaard
01f1c1b8dc feat(): began refactoring PR #5364 2017-01-31 17:10:27 +01:00
bergquist
d4a96b9741 tech(dataproxy): make the code a little bit more defensive 2017-01-16 12:24:08 +01:00
bergquist
dd84fb563a style(dataproxy): renames log functions 2017-01-16 12:23:49 +01:00
bergquist
51bca7d84b tech(dataproxy): moves all parameters to Info call 2017-01-16 12:16:41 +01:00
Ricky Niemi
269d16301a Rename to audit logging to data proxy logging 2017-01-11 07:40:06 -08:00
Ricky Niemi
0fee7c863a Gate data proxy audit logging behind audit_logging server setting 2017-01-11 07:22:57 -08:00
Ricky Niemi
d9cbb994b8 Clean up audit log formatting and code 2017-01-10 11:42:03 -08:00
Ricky Niemi
d03977ac0e Add initial audit logging to data proxy 2017-01-09 22:59:43 -08:00
Carl Bergquist
2c7adccf12 Use cache for http.client in tsdb package. (#6833)
* datasource: move caching closer to datasource struct

* tsdb: use cached version of datasource http transport

closes #6825
2016-12-07 11:10:42 +01:00
stuart nelson
9ed21c6a16 Add transport cache for reverse proxy (#6776)
* Add transport cache for reverse proxy
* Use updated at in cache
2016-12-02 15:39:28 +01:00
Daniel Lee
0618122bcd feat(httpsettings): add tls auth option
- Three text areas where the user can paste
in the CA Cert (optional), Client Cert
and Client Key.

- Tooltips for Auth checkboxes with brief
descriptions of what With Credentials and
With CA Cert are.

- Adds popover for TLS Auth header too.

- Aligns gf-form elements as labels and
checkboxes were not aligned before.

- Makes CA Cert optional as it is only
needed for self-signed certs.
2016-11-24 13:33:28 +01:00
Daniel Lee
387f8cc0c6 feat(dataproxy): TLS CA Cert for self-signed certs
For self-signed TLS Certificates, authentication
with InsecureSkipVerify set to false then this
error will occur:

x509: certificate signed by unknown authority

The solution is to allow the user to upload the
CA cert as well.
2016-11-24 13:22:25 +01:00
Daniel Lee
c9b2c694f1 refactor(dataproxy): TLS Client Auth
Use a SecureJsonData field for TLS
Client Auth instead of 3 new db
fields. Same model as used for
PluginSettings.

Saves and encrypts the pem file
content rather than just saving
the paths to the cert and key.
This allows for uploading from
the Edit Datasource page in
Grafana.
2016-11-24 13:22:25 +01:00