From a95453036b5f9a0f07e5e438d8ebee0e7e72e262 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Wed, 5 Sep 2018 09:46:22 +0200 Subject: [PATCH] Add min time interval to postgres datasource --- public/app/plugins/datasource/postgres/datasource.ts | 2 ++ .../plugins/datasource/postgres/partials/config.html | 10 ++++++++++ public/app/plugins/datasource/postgres/plugin.json | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/postgres/datasource.ts b/public/app/plugins/datasource/postgres/datasource.ts index 6522032b39f..7d4274c8d50 100644 --- a/public/app/plugins/datasource/postgres/datasource.ts +++ b/public/app/plugins/datasource/postgres/datasource.ts @@ -8,6 +8,7 @@ export class PostgresDatasource { jsonData: any; responseParser: ResponseParser; queryModel: PostgresQuery; + interval: string; /** @ngInject */ constructor(instanceSettings, private backendSrv, private $q, private templateSrv, private timeSrv) { @@ -16,6 +17,7 @@ export class PostgresDatasource { this.jsonData = instanceSettings.jsonData; this.responseParser = new ResponseParser(this.$q); this.queryModel = new PostgresQuery({}); + this.interval = instanceSettings.jsonData.timeInterval; } interpolateVariable(value, variable) { diff --git a/public/app/plugins/datasource/postgres/partials/config.html b/public/app/plugins/datasource/postgres/partials/config.html index a4df858db7e..c8b551c2aa8 100644 --- a/public/app/plugins/datasource/postgres/partials/config.html +++ b/public/app/plugins/datasource/postgres/partials/config.html @@ -61,6 +61,16 @@ +
+
+ Min time interval + + + A lower limit for the auto group by time interval. Recommended to be set to write frequency, + for example 1m if your data is written every minute. + +
+

diff --git a/public/app/plugins/datasource/postgres/plugin.json b/public/app/plugins/datasource/postgres/plugin.json index 2c2e1690a65..f236aa01b06 100644 --- a/public/app/plugins/datasource/postgres/plugin.json +++ b/public/app/plugins/datasource/postgres/plugin.json @@ -18,6 +18,10 @@ "alerting": true, "annotations": true, - "metrics": true + "metrics": true, + + "queryOptions": { + "minInterval": true + } }