Andres Martinez Gotor
64c8d32fe7
Use sdk pkg for gtime ( #39354 )
2021-09-21 13:08:52 +02:00
ying-jeanne
c989f0fbbe
SQL: Migrate to use SDK contracts ( #36635 )
...
* convert SQLs to use sdk contracts
* make draft
* postgres
* intermedia
* get datasourceinfo filled at the beginning of the service
* move the interval into package because of cyclict import and fix all postgres tests
* fix mysql test
* fix mssql
* fix the test for pr https://github.com/grafana/grafana/issues/35839
* fix some issue about intervalv2 package
* update sql test
* wire migration for SQLs
* add sqls to the background process
* make it register instead of register and start
* revert formatting
* fix tests
* fix linter
* remove integration test
* Postgres test fix
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-09-07 09:35:37 +02:00
Marcus Efraimsson
0611207f3b
Postgres/MySQL/MSSQL: Fix concurrent map writes panic ( #35510 )
...
Fixes panic/fatal error concurrent map writes in SQL data sources when multiple
queries are executed concurrently and you interpolate SQL query before executing it.
Fixes #35469
2021-06-11 14:56:29 +02:00
ying-jeanne
0b97cdcee1
fix postgres to have precision of ms ( #33853 )
2021-05-10 22:22:13 +08:00
Marcus Efraimsson
dd0ba96d7c
Postgres: Fix time group macro when TimescaleDB is enabled and interval is less than a second ( #33153 )
...
Fixing a special case with time group macro when
using TimescaleDB and interval is lower than a second.
Fixes #33124
2021-04-21 12:54:49 +02: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
Ricky Putra
d56c5285e2
Postgres: Fix timeGroup macro converts long intervals to invalid numbers when TimescaleDB is enabled ( #31179 )
...
Fixes #27253
2021-02-15 17:15:57 +01:00
Arve Knudsen
f55818ca70
Chore: Enable exhaustive linter ( #29458 )
...
* Chore: Enable exhaustive linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-01 09:53:27 +01:00
Arve Knudsen
2bf964c61e
Chore: Fix linting issues caught by ruleguard ( #28799 )
...
* Chore: Fix linting issues caught by ruleguard
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Improve error check
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:27:45 +01:00
Arve Knudsen
574553ec7b
Chore: Fix issues found by staticcheck ( #28802 )
...
* Fix linting issues
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 11:29:39 +01:00
Arve Knudsen
4b1eb6e5c7
Chore: Enable gocyclo linter ( #26395 )
...
* Chore: Enable gocyclo linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* API: Fix linting issue
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* API: Refactor to reduce complexity
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix type assertion
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-07 22:10:06 +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
Kyle Brandt
e5bf3027fc
Refactor: Move sql_engine to sub package of tsdb ( #18991 )
...
this way importing the tsdb package does not come with xorm dependencies
2019-09-10 15:50:04 -04:00
Bernard Duggan
a0bb01103e
MySQL/Postgres/MSSQL: Add parsing for day, weeks and year intervals in macros ( #13086 )
...
closes #11431
2019-05-30 09:58:29 +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
Ander Arguiñano
3801a75131
FIxed syntaxis mistake unixEpochNanoFrom and unixEpochNanoTo
2019-01-03 22:25:10 +01:00
Ander Arguiñano
ed6782402b
Merge remote-tracking branch 'upstream/master' into nanosecond-postgresql
2019-01-03 21:48:10 +01:00
Ander Arguiñano
9105625f24
Added unixEpochNanoTo and unixEpochNanoFrom macros to postgresql
2019-01-03 21:31:47 +01:00
Ander Arguiñano
4d8d2a9690
Renamed unixEpochFilterNano to unixEpochNanoFilter
2019-01-03 20:40:17 +01:00
Sven Klemm
4c51e8df20
Don't cut off subsecond precision for postgres macros
...
Change time format to RFC3339Nano for $__timeFilter, $__timeFrom and
$__timeTo macros
2019-01-02 23:38:09 +01:00
Ander Arguiñano
1a67a8db80
Nanosecond timestamp support postgresql
2019-01-02 23:00:21 +01:00
Marcus Efraimsson
624e5e5b3d
let each sql datasource handle timeFrom and timeTo macros
2018-11-30 14:30:02 +01:00
Sven Klemm
94d6d51726
move timeFrom, timeTo, unixEpochFrom and unixEpochTo macros to sql_engine
2018-10-02 20:19:34 +02:00
Sven Klemm
0254a29e35
Interpolate $__interval in backend for alerting with sql datasources ( #13156 )
...
add support for interpolate $__interval and $__interval_ms in sql datasources
2018-09-13 16:51:00 +02:00
Marcus Efraimsson
313a8bd033
Merge pull request #12891 from svenklemm/unixepochgroup
...
add $__unixEpochGroup and $__unixEpochGroupAlias to sql datasources
2018-08-17 14:41:33 +02:00
Marcus Efraimsson
74077be19e
Merge pull request #12680 from svenklemm/timebucket
...
[postgres] add timescaledb option to postgres datasource
2018-08-14 12:12:43 +02:00
Sven Klemm
3955133f7e
Don't pass datasource to newPostgresMacroEngine
2018-08-14 09:15:24 +02:00
Sven Klemm
3552a4cb86
refactor timescaledb handling in MacroEngine
2018-08-14 08:47:33 +02:00
Sven Klemm
bfe28ee061
Add $__unixEpochGroup macro to postgres datasource
2018-08-13 12:08:14 +02:00
Sven Klemm
d81a23becf
Refactor setting fillmode
...
This adds SetupFillmode to the tsdb package to be used by the sql
datasources.
2018-08-12 10:51:58 +02:00
Sven Klemm
d2984f3b0f
fix rebase error
2018-08-09 10:14:14 +02:00
Sven Klemm
c3aad10047
change timescaledb to checkbox instead of select
2018-08-09 10:05:35 +02:00
Sven Klemm
b987aee7cf
add timescaledb option to postgres datasource
...
This adds an option to the postgres datasource config for
timescaledb support. When set to auto it will check for
timescaledb when testing the datasource.
When this option is enabled the $__timeGroup macro will
use the time_bucket function from timescaledb to group
times by an interval.
This also passes the datasource edit control to testDatasource
to allow for setting additional settings, this might be useful
for other datasources aswell which have optional or version
dependant features which can be queried.
2018-08-09 10:05:35 +02:00
Sven Klemm
ee7602ec1f
change fillmode from last to previous
2018-08-07 21:01:41 +02:00
Sven Klemm
bfc66a7ed0
add fillmode "last" to sql datasource
...
This adds a new fill mode last (last observation carried forward) for grafana
to the sql datasources. This fill mode will fill in the last seen value in a
series when a timepoint is missing or NULL if no value for that series has
been seen yet.
2018-08-02 20:35:09 +02:00
Sven Klemm
dc22e24642
add compatibility code to handle pre 5.3 usage
2018-08-01 15:06:18 +02:00
Sven Klemm
42f1892826
Add $__timeGroupAlias to postgres macros
2018-08-01 09:03:34 +02:00
Sven Klemm
43295f9c18
remove alias from postgres $__timeGroup macro
2018-08-01 08:50:19 +02:00
Marcus Efraimsson
2f3851b915
postgres: use new sql engine
2018-07-26 18:10:17 +02:00
Sven Klemm
c2c22c142b
[postgres] fix timeGroup macro rounding ( #12468 )
...
* fix timeGroup tests to check for correct grouping
* do explicit floor rounding in $__timeGroup macro
* fix typo in comments
2018-07-01 06:55:46 -07:00
Sven Klemm
5dc36afe71
calculate datetime for timeFrom and timeTo macro in go
2018-04-16 23:02:24 +02:00
Sven Klemm
a2a7d3d436
add GetFromAsTimeUTC and GetToAsTimeUTC and use them in timeFilter macro
2018-04-16 19:38:35 +02:00
Sven Klemm
6d3da9a73d
remove postgresversion and convert unix timestamp in go
2018-04-15 22:14:13 +02:00
Sven Klemm
9b61ffb48a
make timefilter macro aware of pg version
2018-04-15 18:38:20 +02:00
Marcus Efraimsson
a86ee304ff
tsdb: remove unnecessary type casts in sql data sources macro engines
2018-04-12 19:08:35 +02:00
Marcus Efraimsson
f5586b1270
tsdb: sql data sources should handle time ranges before epoch start correctly
2018-04-12 18:53:12 +02:00
ryan
113bfb3d3e
don't convert to uint64
2018-04-09 13:28:32 +02:00
Sven Klemm
f1ba9137c0
remove spaces around arguments before calling macro expansion
2018-03-02 19:20:30 +01:00
Sven Klemm
e2a3590d8b
allow optional 3rd argument to timeGroup to control filling missing
...
values
2017-12-10 09:59:33 +01:00
Sven Klemm
b6df91d56b
pass Query to MacroEngine Interpolate
2017-12-08 23:30:33 +01:00