247 Commits

Author SHA1 Message Date
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
8d6513a564 fix cloudwatch alert bug 2017-09-29 13:45:11 +09:00
5e88177f28 add debug log 2017-09-29 13:45:11 +09:00
468e8c13ee move extend statistics handling code to backend 2017-09-29 13:45:11 +09:00
6c375ed2cb fix assume role 2017-09-29 13:45:11 +09:00
f3a2dc7c5f improve cloudwatch tsdb 2017-09-29 13:45:11 +09:00
a21f53cf82 refactor cloudwatch code 2017-09-29 13:45:11 +09:00
59cdd4d8d2 remove obsolete code 2017-09-29 13:45:11 +09:00
fe9fca381c move cloudwatch crendential related code 2017-09-29 13:45:11 +09:00
e1fe15e094 fix annotation query 2017-09-29 13:45:11 +09:00
d98d8a404f fix dimension convertion 2017-09-29 13:45:11 +09:00
c140d7aa06 re-implement annotation query 2017-09-29 13:45:11 +09:00
8f3b060946 fix parameter format 2017-09-29 13:44:01 +09:00
17445e0c98 fix alert feature 2017-09-29 13:44:01 +09:00
8243ac39c2 fix parameter format 2017-09-29 13:44:01 +09:00
fe1d395d79 refactor cloudwatch to support new tsdb interface 2017-09-29 13:44:01 +09:00
1dcc51adce re-implement dimension_values() 2017-09-29 13:44:01 +09:00
ec632bb9ed fix error message 2017-09-29 13:44:01 +09:00
8fba6dcb0d re-implement ec2_instance_attribute() 2017-09-29 13:44:01 +09:00
cf23734d7d re-implement ebs_volume_ids() 2017-09-29 13:44:01 +09:00
e588b682fb import the change, https://github.com/grafana/grafana/pull/9268 2017-09-29 13:44:01 +09:00
36a537a3ce fix conflict 2017-09-29 13:44:01 +09:00
fa074249e4 fix test 2017-09-29 13:44:01 +09:00
f590db1b78 move test code 2017-09-29 13:44:01 +09:00
1d265e05c9 fix conflict 2017-09-29 13:44:01 +09:00
fe3d3bc384 porting other suggestion 2017-09-29 13:44:01 +09:00
feed90c0e2 re-implement get regions 2017-09-29 13:44:01 +09:00
0c95148486 move the metric find query code 2017-09-29 13:44:01 +09:00
62d84c1e14 (cloudwatch) move query parameter to 'parameters' 2017-09-29 13:44:01 +09:00
110f157621 parse duration 2017-09-29 13:44:01 +09:00
c6607f3fa7 remove offset for startTime 2017-09-29 13:44:01 +09:00
dcb5ea58ce count up metrics 2017-09-29 13:44:00 +09:00
39607d09d7 (cloudwatch) alerting 2017-09-29 13:44:00 +09:00
3641e85233 testdata: add bucket scenarios for heatmap
these scenarios makes it easier debug panels based
on the same numbers without sharing datasource

ref #9332
2017-09-24 22:08:28 +02:00
ed661767f8 follow go idiom and return error as second param 2017-09-21 18:04:16 +02:00
a45e2ec9c3 context is reserved for go's context 2017-09-21 15:23:34 +02:00
16b5b9f6be make ds a param for Query 2017-09-21 15:09:14 +02:00
c0260fd913 remove batch abstraction 2017-09-21 15:02:17 +02:00
7f9f388293 rename executor into tsdbqueryendpoint 2017-09-21 15:02:17 +02:00
0229d28d64 remove unused structs 2017-09-21 15:02:17 +02:00
55f1b36e31 refactor response flow 2017-09-21 15:02:17 +02:00
8c8fdadb78 trace failed executions 2017-09-18 11:08:58 +02:00
e128310045 use tags instead of logs 2017-09-18 11:08:58 +02:00
f160ad3bc8 add trace parameters for outgoing requests 2017-09-18 11:08:58 +02:00
d6b8c6a2d2 add graphite bridge that support delta counters 2017-09-14 14:26:32 +02:00
652fce7e76 Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
2017-09-07 17:50:11 +08:00
c5400ffe76 mysql: use collation instead of charset (#9156)
- use charset would issue additional 'SET NAMES <VALUE>' queries, set
collation would be better. see: https://github.com/go-sql-driver/mysql#charset
2017-09-04 12:32:07 +02:00
bdfbc2453f Use parenthesis to surround the selected tags for influxdb queries (#9131)
The generated queries when selecting multiple tags are incorrect. In
InfluxQL, `AND` has a higher precedence than `OR` so the condition:

    WHERE "hostname" = 'server1' OR "hostname" = 'server2' AND time > now() - 5m

This is parsed as if it were:

    WHERE "hostname" = 'server1' OR ("hostname" = 'server2' AND time > now() - 5m)

But the intention is to write a query like this:

    WHERE ("hostname" = 'server1' OR "hostname" = 'server2') AND time > now() - 5m

This change modifies the generated query so it surrounds a query with
multiple conditions in parenthesis so it doesn't conflict with the time
expression in an unexpected way.

This is currently not an issue because InfluxDB doesn't actually
evaluate the condition for the time expression correctly. It just looks
through the AST for anything that looks like a time expression and then
assumes the proper format of `AND` was used rather than validating that
it was used correctly.
2017-08-31 09:33:03 +02:00
c92317bafa fix: fixed gofmt formating for #9091 2017-08-28 13:29:24 +02:00
3eea5d235d Added import for container/list 2017-08-24 15:42:54 -04:00