Commit Graph

68 Commits

Author SHA1 Message Date
Marcus Efraimsson
3fc5f4552a CloudWatch: Fix high CPU load (#20579)
* Cache decrypted securejsondata
* Models: Add datasource cache tests
2019-11-22 14:21:23 +01:00
Sofia Papagiannaki
b5f0a5d5ca
Api: Readonly datasources should not be created via the API (#19006)
* Readonly datasources should not be created via the API

* Return correct `ReadOnly` value in GetDataSourceByName
2019-09-17 12:29:43 +03:00
Marcus Efraimsson
0a3f977ea2
Usage Stats: Update known datasource plugins (#17787) 2019-06-26 21:15:45 +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
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
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
Daniel Lee
dd96f2a522 azuremonitor: move files into grafana
Initial port of the code from the plugin - lots of small things to fix.
2019-01-17 10:55:03 +01:00
Marcus Efraimsson
2332b3e205
remove unused code 2018-10-30 09:34:09 +01:00
Leonard Gram
3245227016 permissions: cleanup. 2018-10-17 15:58:52 +02:00
Leonard Gram
ccfcf02e33 Refactors ds permissions to a filter. 2018-10-10 14:25:57 +02:00
Marcus Efraimsson
17a5e32f23
remove datasource permission admin for now 2018-10-09 15:23:28 +02:00
Marcus Efraimsson
4d719b0d05
Merge remote-tracking branch 'origin/master' into noop-services-poc 2018-10-08 16:02:44 +02:00
Torkel Ödegaard
162a95bff9 wip: going in circles 2018-10-01 19:31:03 +02:00
Torkel Ödegaard
b3c78f1265 wip: data source permissions hooks 2018-10-01 15:38:55 +02:00
Daniel Lee
6f5fbf7a43 fixes strange gofmt formatting
VS code refuses to format this correctly unless the zabbix ds
is last in the list.
2018-09-14 17:11:58 +02:00
Erik Sundell
31417b795c Stackdriver: Exposing stackdriver backend api 2018-09-14 09:38:16 +02:00
bergquist
ff7b0d4f63 go fmt fixes 2018-08-28 22:14:15 +02:00
David Kaltschmidt
d5196ab322 remove internal influx ifql datasource 2018-06-14 20:42:33 +01:00
David Kaltschmidt
08ee1da6b1 InfluxDB IFQL datasource 2018-06-04 12:24:47 +02:00
Karsten Weiss
b7adf28501 Remove redundancy in variable declarations (golint)
This commit fixes the following golint warnings:
pkg/api/avatar/avatar.go:229:12: should omit type *http.Client from declaration of var client; it will be inferred from the right-hand side
pkg/login/brute_force_login_protection.go:13:26: should omit type time.Duration from declaration of var loginAttemptsWindow; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:58:26: should omit type []string from declaration of var metricCategoryPrefix; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:69:22: should omit type []string from declaration of var trimMetricPrefix; it will be inferred from the right-hand side
pkg/models/alert.go:37:36: should omit type error from declaration of var ErrCannotChangeStateOnPausedAlert; it will be inferred from the right-hand side
pkg/models/alert.go:38:36: should omit type error from declaration of var ErrRequiresNewState; it will be inferred from the right-hand side
pkg/models/datasource.go:61:28: should omit type map[string]bool from declaration of var knownDatasourcePlugins; it will be inferred from the right-hand side
pkg/plugins/update_checker.go:16:13: should omit type http.Client from declaration of var httpClient; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:103:24: should omit type time.Duration from declaration of var unfinishedWorkTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:105:19: should omit type time.Duration from declaration of var alertTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:106:19: should omit type int from declaration of var alertMaxAttempts; it will be inferred from the right-hand side
pkg/services/alerting/notifier.go:143:23: should omit type map[string]*NotifierPlugin from declaration of var notifierFactories; it will be inferred from the right-hand side
pkg/services/alerting/rule.go:136:24: should omit type map[string]ConditionFactory from declaration of var conditionFactories; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:12:15: should omit type []string from declaration of var defaultTypes; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:13:15: should omit type []string from declaration of var rangedTypes; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/opsgenie.go:44:19: should omit type string from declaration of var opsgenieAlertURL; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/pagerduty.go:43:23: should omit type string from declaration of var pagerdutyEventApiUrl; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/telegram.go:21:17: should omit type string from declaration of var telegramApiUrl; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:11:24: should omit type string from declaration of var simpleDashboardConfig; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:12:24: should omit type string from declaration of var oldVersion; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:13:24: should omit type string from declaration of var brokenConfigs; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:22:30: should omit type time.Duration from declaration of var checkDiskForChangesInterval; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:24:23: should omit type error from declaration of var ErrFolderNameMissing; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:15:34: should omit type string from declaration of var twoDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:16:34: should omit type string from declaration of var twoDatasourcesConfigPurgeOthers; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:17:34: should omit type string from declaration of var doubleDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:18:34: should omit type string from declaration of var allProperties; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:19:34: should omit type string from declaration of var versionZero; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:20:34: should omit type string from declaration of var brokenYaml; it will be inferred from the right-hand side
pkg/services/sqlstore/stats.go:16:25: should omit type time.Duration from declaration of var activeUserTimeLimit; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:69:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:70:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:95:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:96:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/setting/setting.go:42:15: should omit type string from declaration of var Env; it will be inferred from the right-hand side
pkg/setting/setting.go:161:18: should omit type bool from declaration of var LdapAllowSignup; it will be inferred from the right-hand side
pkg/setting/setting.go:473:30: should omit type bool from declaration of var skipStaticRootValidation; it will be inferred from the right-hand side
pkg/tsdb/interval.go:14:21: should omit type time.Duration from declaration of var defaultMinInterval; it will be inferred from the right-hand side
pkg/tsdb/interval.go:15:21: should omit type time.Duration from declaration of var year; it will be inferred from the right-hand side
pkg/tsdb/interval.go:16:21: should omit type time.Duration from declaration of var day; it will be inferred from the right-hand side
pkg/tsdb/cloudwatch/credentials.go:26:24: should omit type map[string]cache from declaration of var awsCredentialCache; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:15:27: should omit type *regexp.Regexp from declaration of var regexpOperatorPattern; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:16:27: should omit type *regexp.Regexp from declaration of var regexpMeasurementPattern; it will be inferred from the right-hand side
pkg/tsdb/mssql/mssql_test.go:25:14: should omit type string from declaration of var serverIP; it will be inferred from the right-hand side
2018-04-27 22:14:36 +02:00
Marcus Efraimsson
d4beee2bb0 Merge branch 'master' into mssql_datasource 2018-03-13 16:03:02 +01:00
Torkel Ödegaard
3964d6b797 fix: added new known data source plugins, and minor migration fix for v1 dashboards 2018-02-20 16:08:43 +01:00
linux chips
c75f9a1923 MSSQL Data Source 2017-12-02 14:40:12 +03:00
bergquist
ebbfc529e0 datasource as cfg: support globbing 2017-11-15 14:30:32 +01:00
bergquist
36676e23c1 datasource as cfg: adds readonly datasources 2017-11-15 14:30:32 +01:00
bergquist
0f29b8ac83 datasources as cfg: tests for insert/updating datasources 2017-11-15 14:30:32 +01:00
bergquist
d68bfaa8be datasource as cfg: typo 2017-10-25 12:21:06 +02:00
bergquist
89923bf77a datasources: change to optimisic concurrency
prerequisite for #9504
2017-10-23 07:55:16 +02:00
bergquist
b3a8d93dca mysql: add usage stats for mysql 2017-10-19 10:30:54 +02:00
Daniel Lee
d1c9760fa8 Postgres Data Source (#9475)
* add postgresql datasource

* add rest of files for postgres datasource

* fix timeseries query, remove unused code

* consistent naming, refactoring

* s/mysql/postgres/

* s/mysql/postgres/

* couple more tests

* tests for more datatypes

* fix macros for postgres

* add __timeSec macro

* add frontend for postgres datasource

* adjust documentation

* fix formatting

* add proper plugin description

* merge editor changes from mysql

* port changes from mysql datasource

* set proper defaultQuery for postgres

* add time_sec to timeseries query
accept int for value for timeseries query

* revert allowing time_sec and handle int or float values as unix
timestamp for "time" column

* fix tslint error

* handle decimal values in timeseries query

* allow setting sslmode for postgres datasource

* use type switch for handling data types

* fix value for timeseries query

* refactor timeseries queries to make them more flexible

* remove debug statement from inner loop in type conversion

* use plain for loop in getTypedRowData

* fix timeseries queries

* adjust postgres datasource to tsdb refactoring

* adjust postgres datasource to frontend changes

* update lib/pq to latest version

* move type conversion to getTypedRowData

* handle address types cidr, inet and macaddr

* adjust response parser and docs for annotations

* convert unknown types to string

* add documentation for postgres datasource

* add another example query with metric column

* set more helpful default query

* update help text in query editor

* handle NULL in value column of timeseries query

* add __timeGroup macro

* add test for __timeGroup macro

* document __timeGroup and set proper default query for annotations

* fix typos in docs

* add postgres to list of datasources

* add postgres to builtInPlugins

* mysql: refactoring as prep for merging postgres

Refactors out the initialization of the xorm engine and the query logic
for an sql data source.

* mysql: rename refactoring + test update

* postgres:refactor to use SqlEngine(same as mysql)

Refactored to use a common base class with the MySql data source.

Other changes from the original PR:
- Changed time column to be time_sec to allow other time units in the
future and to be the same as MySQL
- Changed integration test to test the main Query method rather than
the private transformToTable method
- Changed the __timeSec macro name to __timeEpoch
- Renamed PostgresExecutor to PostgresQueryEndpoint

Fixes #9209 (the original PR)

* postgres: encrypt password on config page

With some other cosmetic changes to the config page:
- placeholder texts
- reset button for the password after it has been encrypted.
- default value for the sslmode field.

* postgres: change back col name to time from time_sec

* postgres mysql: remove annotation title

Title has been removed from annotations

* postgres: fix images for docs page

* postgres mysql: fix specs
2017-10-10 15:19:14 +02:00
bergquist
93cff1a42a move more known datasources from others 2017-09-15 14:26:29 +02:00
Torkel Ödegaard
4ce0bf4d16 mysql: improved mysql data source, added test feature when adding data source, fixed cache issue 2017-05-11 10:50:24 +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
huydx
143cbe921f (feat) support datasource delete by name api 2017-02-10 23:30:14 +09:00
Torkel Ödegaard
01f1c1b8dc feat(): began refactoring PR #5364 2017-01-31 17:10:27 +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
Joe Lanford
56b7e2dfaf Added support for TLS client auth for datasource proxies (#5801) 2016-11-24 13:22:25 +01:00
Torkel Ödegaard
a6918617ff feat(api): fixed minor issue with error message when trying to create duplicate datasource, fixes #6164 2016-10-01 16:41:27 +02:00
Nozomi Anzai
6586cc4029 Add the datasource of RDBMS (PostgreSQL and MySQL) 2016-06-13 18:24:18 +09:00
Torkel Ödegaard
34e17f7282 feat(alerting): requests looks to be working again 2016-06-06 17:11:46 +02:00
Torkel Ödegaard
1f9f439acb lib(): added simplejson lib 2016-03-11 23:28:33 +01:00
Mitsuhiro Tanda
6edd6c8f03 add with_credentials to datasource model 2015-12-09 14:44:28 +09:00
Torkel Ödegaard
323e84375b refactoring: minor refactoring and handling of known data source plugins 2015-10-26 16:37:45 +01:00
Torkel Ödegaard
c816ed2527 feat(usage stats): added data source count stats 2015-09-29 13:47:56 +02:00
Mitsuhiro Tanda
00f76ecaf6 CloudWatch proxy support 2015-08-20 00:51:23 +09:00
Torkel Ödegaard
e2f6633d57 Began work on data source test / validation, #1997 & #2043 2015-06-01 12:15:49 +02:00
Torkel Ödegaard
9710771f16 Added basic auth to data source edit/create, add support for basic auth in data source proxy code, Closes #1510 2015-03-02 09:58:35 +01:00
Torkel Ödegaard
d0d995da09 Inital work on SQL metric/annotation data source, #1542 2015-02-28 17:27:30 +01:00
Torkel Ödegaard
c198242292 A lot of work on backend plugin model for frontend components, right now for data sources, will enable dropin plugins for data sources and panels, #1472 2015-02-27 22:29:00 +01:00