Commit Graph

149 Commits

Author SHA1 Message Date
Gábor Farkas
9f027e32b7
InfluxDB: Flux: make $__interval and $__interval_ms work in alerting (#38889)
* influxdb: flux: handle $__interval and $__interval_ms in alert-queries

* influxdb: flux: do not handle interval-variable in the frontend

* $__interval should be rounded

* added comment
2021-09-27 12:03:04 +02:00
Gábor Farkas
bf0dc3ef62
influxdb: flux: use more precise start and end timestamps (#39415)
* influxdb: flux: use more precise start and end timestamps

* added unit test
2021-09-22 15:26:36 +02:00
Gábor Farkas
d116b2d71b
influxdb: influxql: more robust resultformat-handling (#39330) 2021-09-17 12:33:09 +02:00
Dimitris Sotirakis
fdc681788b
InfluxDB: Fix regex to identify / as separator (#39185)
* Fix regex to identify / as separator

* Update regex
2021-09-15 09:37:33 +01:00
Gábor Farkas
3f0f448201
influxdb: influxql: explicit min-interval check (#38873)
* influxdb: influxql: explicit min-interval check

* added test
2021-09-07 09:49:34 +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
Gábor Farkas
6cab44d73a
InfluxDB: InfluxQL: handle new-alerting better (#37588)
* influxdb: influxql: alert: use already-computed interval-value when available

* reverted by-mistake changed import

* simplify code

now we can rely on DataQuery.Interval always being good

* removed unnecessary test

* fix lint-error
2021-09-06 09:33:07 +02:00
Arve Knudsen
78596a6756
Migrate to Wire for dependency injection (#32289)
Fixes #30144

Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
Co-authored-by: spinillos <selenepinillos@gmail.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-08-25 15:11:22 +02:00
Will Browne
1618d5ad6f
use most appropriate func for registering core plugins (#38497) 2021-08-25 10:08:48 +02:00
Ivana Huckova
1083bef030
Prometheus: Implement stepMode for alerting queries (#36796)
* Add select component for choosing step option

* Add onStepChange

* Add functionality for max step

* Rename minInterval to stepInterval to describe min, max and exact step interval

* Change select option from standard to exact

* Add new type StepType for better type safety

* Add tests for adjustInterval

* Add functionality and tests for exact step option

* Prometheus: Spell out min and max in select component

* Prometheus: Change width of step select component and add placeholder

* Prometheus: Adjust for the factor in exact step

* Prometheus: Update tooltip of step lable to include max and exact options and add padding to select component to give it some breathing room from other components

* Update snapshot for step tooltip

* Prometheus: make tooltip more informative

* Prometheus: add tooltip to interval input element

* Prometheus: extract default step option

* Prometheus: update snapshot for PromQueryEditor

* Prometheus: change step labels to uppercase

* Prometheus: define a default step option

* Prometheus: use default step option in both ui component and logic

* Prometheus: update snapshot for PromQueryEditor

* Prometheus: refactor datasource.ts for better readability

* Prometheus: change tool tip for step

* Prometheus: update snapshots

* Prometheus: add correct styling

* Prometheus: update snapshots

* Prometheus change variable name to something less superfluous

* Prometheus: refactor

* Prometheus: add new test for adjustInterval

* Docs: Update docummentation on the step parameter for prometheus

* Prometheus: make step input field smaller and change placeholder text to 15s

* Prometheus: update snapshots

* Prometheus: Make stepMode uniform in all places in the code

* Adjust step based on stepMode

* Adjust comment

* Check if we have queryInterval

* Refactor, add safe interval

* Fix merge resolutions

* Fix tests and add tests

* Update snapshot

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/prometheus.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Implement calculation with intervalMode in calculator.go

* Update tests, add calculate safe interval method

* Replace panic with error

* Update pkg/tsdb/interval/interval_test.go

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>

* Update pkg/tsdb/calculator_test.go

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>

* Impotrt require

* Remove lint errors

Co-authored-by: Olof Bourghardt <ob655088@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
2021-08-05 09:09:49 +02:00
idafurjes
cec12676e7
Chore: Refactor influxdb to use SDK contracts (#36189)
* Use backend SDK for influxdb

* Remove BasicAuth condition, some comments

* Remove not used fields from datasource info

* Register InfluxDBService

* Fix casting and make HTTPClientProvider exported

* Remove unused function

* Remove empty line

* Update pkg/tsdb/influxdb/flux/query_models.go

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>

* Read interval from TimeRange instead of Interval

* Change pkg name from datasource->models, minor changes

* Use testify instead of convey

* Add new calculator logic and fix pointer semantic for dsInfo

* Initialise parsers, use tsdb interval pkg

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
2021-07-19 11:32:33 +02:00
Gábor Farkas
e4ece0530a
InfluxDB: Flux: fix backward compatibility for some queries (#36603)
* influxdb: flux: better backward-compatibility

* added comment-explanation
2021-07-09 17:37:14 +02:00
Gábor Farkas
38b030e2a4
InfluxDB: Flux: timestamp-column has to go first (#35036) 2021-06-01 16:03:02 +02:00
Torkel Ödegaard
987bffe482
TestData: Support for csv files & csv content (#34674)
* initial implementation of csv support for test data source

* CSV file & content scenarios working

* Removing categorical data

* fixing handler names

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/tsdb/testdatasource/csv_data.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fixed lint issues

* updated so it uses the same parsing

* more CSV tests

* lint fixes

* more lint

* lint

* support time field

* migrate manual entry to csv

* more test output

* more test output

* missing file

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-05-26 10:42:42 +02:00
Gábor Farkas
ab26c4dfa4
InfluxDB: Flux: handle boolean data-columns (#34479)
* InfluxDB: Flux: handle boolean data-columns

* normalize data-type strings based on documentation

* reference missing data type
2021-05-25 17:22:04 +02:00
Marcus Efraimsson
348e76fc8e
Datasource: Shared HTTP client provider for core backend data sources and any data source using the data source proxy (#33439)
Uses new httpclient package from grafana-plugin-sdk-go introduced 
via grafana/grafana-plugin-sdk-go#328. 
Replaces the GetHTTPClient, GetTransport, GetTLSConfig methods defined 
on DataSource model.
Longer-term the goal is to migrate core HTTP backend data sources to use the 
SDK contracts and using httpclient.Provider for creating HTTP clients and such.

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-19 23:53:41 +02:00
Gábor Farkas
2633f245ba
InfluxDB: Flux: Improve handling of complex response-structures (#33823) 2021-05-11 12:36:04 +02:00
Ryan McKinley
7627b55ef4
TSDB: add deprecation comments to many tsdb structs (#33281) 2021-04-23 03:03:11 +02:00
Gábor Farkas
7ff6665ac2
Alerting: InfluxDB: InfluxQL: convert backend-code to use dataframes (#32950)
* alerting: influxdb: refactor unit-tests

* alerting: influxdb: converted code from timeseries-mode to dataframe-mode

* influxdb: simplify code

* influxdb: better function name

* influxdb: alerting: more tests

* influxdb: alerting: more tests

* influxdb: refactor

* influxdb: improved unit-test

* influxdb: simplified code

* influxdb: refactor reponse-parser code

* influxdb: refactor unit tests

* influxdb: alerting: use nicer names

Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
2021-04-22 08:43:17 +02:00
Dimitris Sotirakis
270a255c08
Add dash / and at @ signs escapes in regex (#32495) 2021-03-30 15:56:15 +03:00
Dimitris Sotirakis
95de48261b
Chore: Move away from convey - introduce testify (#32295)
* Generic OAuth: Prevent adding duplicated users

* Chore: Move away from convey - introduce testify

* Revert commits from another branch

* Fix formatting
2021-03-24 17:32:16 +01:00
Dimitris Sotirakis
fdaac2b8fb
Notifications: InfluxDB - Fix regex to include metrics with hyphen in aliases (#32224)
* Notifications: InfluxDB - fix regex to include metrics with hyphen

* Add hyphen check in tests
2021-03-23 13:14:21 +02:00
Kyle Brandt
026bf1f9ca
SSE/InfluxDB: Change InfluxQL to work with server side expressions (#31691)
* SSE/InfluxDB: Change InfluxQL to work with server side expressions
updates the request to handle EpochMS as the time range (which is what expressions sends)
and the response to use millisecond timestamps instead of seconds.
fixes #31604
similar to https://github.com/grafana/grafana/pull/31455
2021-03-18 08:02:37 -04: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
Gábor Farkas
8d39e6640c
InfluxDB: Improve maxDataPoints error-message in Flux-mode, raise limits (#31259)
* influxdb: flux: improve error-message

* influxdb: flux: raise max-points tolerance limit

* influxdb: flux: better error-message

* influxdb: flux: different approach to nice-error-message-generation

* influxdb: flux: removed unnecessary whitespace

* influxdb: flux: better error message, new approach

* influxdb: flux: test max-data-points-exceeded situtation
2021-03-02 18:33:51 +01:00
Gábor Farkas
1e7f2e93e6
InfluxDB: handle columns named "table" (#30985)
* influxdb: flux: manually calculate table-group-key

* influxdb: flux: added explanation about the group-key
2021-02-23 16:44:33 +01:00
Andrej Ocenas
e0448513eb
Influx: Make max series limit configurable and show the limiting message if applied (#31025)
* Add configuration in ConfigEditor and default to 1000

* Show data in explore if any even if there is an error

* Update pkg/tsdb/influxdb/flux/executor.go

* Better handling of defaults

* Add test for runQuery to show data even with error

* Update public/app/store/configureStore.ts

Co-authored-by: Giordano Ricci <gio.ricci@grafana.com>

* Update public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>

* Update tooltip

* Update input

* Lint fixes

* Update snapshots

* Update decorator tests

Co-authored-by: Giordano Ricci <gio.ricci@grafana.com>
Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
2021-02-10 15:23:19 +01:00
David
1bdd3eb3dd
Influx: Show all datapoints for dynamically windowed flux query (#30688) 2021-01-28 11:36:17 +01:00
Emil Hessman
2b9387210b
Chore: Rewrite tsdb influxdb test to standard library (#30091) 2021-01-07 09:31:34 +01:00
Emil Hessman
5c0094feef
Chore: Rewrite influxdb query parser test to standard library (#29940) 2020-12-21 07:51:46 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter (#29751)
* Disable default golangci-lint filter

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

* Chore: Fix linter warnings

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Ryan McKinley
cfaca42e97
InfluxDB: update flux library and support boolean label values (#29310) 2020-11-23 13:19:52 -08:00
Arve Knudsen
4dd7b7a82d
Chore: Remove unused Go code (#28852)
* Chore: Remove more unused Go code

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:51:31 +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
a078e40238
Settings: Rename constants/variables to follow Go naming standards (#28002)
* settings: Rename constants/variables to follow Go naming standards
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-02 15:45:45 +02:00
Arve Knudsen
a5d9196a53
Chore/fix lint issues (#27704)
* Chore: Fix linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-22 16:22:19 +02:00
Ryan McKinley
6b0f56b726
InfluxDB: Alerting issue, reasonable defaults for interval and maxDataPoints (#27463) 2020-09-09 09:34:17 +02:00
Ryan McKinley
ae385983f4
InfluxDB: support flux editor for template queries (#27370) 2020-09-03 14:11:39 -07:00
Ryan McKinley
0bc67b032a
InfluxDB: return a table rather than an error when timeseries is missing time (#27320) 2020-09-01 15:06:38 -07:00
Ryan McKinley
cd9a773427
InfluxDB: use converters from SDK (#27138) 2020-08-24 13:19:32 -07:00
Arve Knudsen
c207ea12a4
InfluxDB: Clean up tests (#27135)
* InfluxDB: Clean up tests

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

* InfluxDB: Platform agnostic paths

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-21 18:34:21 +02:00
Ryan McKinley
a2a6b9448f
InfluxDB: exclude result and table column from Flux table results (#27081) 2020-08-20 10:52:46 -07:00
Arve Knudsen
0e1e85656b
InfluxDB: Upgrade InfluxDB in devenv (#26983)
* InfluxDB: Upgrade InfluxDB in devenv
* InfluxDB: De-export symbols
* InfluxDB: Remove unused code
* devenv: Make InfluxDB version configurable

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-19 09:23:11 +02:00
Arve Knudsen
be3bf80749
InfluxDB: Upgrade to latest InfluxDB Go client (#27021)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-17 08:32:26 +02:00
Arve Knudsen
50ebbb625e
InfluxDB: Upgrade Go client, use data source HTTP client (#27012)
* InfluxDB: Upgrade Go client, use data source HTTP client

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

* Remove unnecessary Close

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-14 18:40:02 +02:00
Arve Knudsen
c63bbbaec3
InfluxDB: Close Flux query results (#26917)
* InfluxDB: Drop ctxhttp usage
* InfluxDB: Clean up code
* InfluxDB: Close query results

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-13 17:50:53 +02:00
Arve Knudsen
37c278c8f3
InfluxDB: Less chatty logging (#26850)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-07 09:18:57 +02:00
Paul Sneddon
a0c1e53fd0
Flux: Increase series limit for Flux queries (#26746) 2020-07-31 15:14:58 -07:00
Paul Sneddon
ec756f3729
Flux: Ensure connections to InflxuDB are closed (#26735)
* Flux: Ensure connections to InflxuDB are closed
2020-07-31 23:11:51 +02:00
Arve Knudsen
d4e4cb4c71
Chore: Enable Go linter gocritic (#26224)
* Chore: Enable gocritic linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-16 14:39:01 +02:00