Commit 21e7b0b9 by Sven Klemm

add min interval to postgres datasource

parent ea110b59
...@@ -38,6 +38,18 @@ ...@@ -38,6 +38,18 @@
</div> </div>
</div> </div>
<div class="gf-form-group">
<div class="gf-form-inline">
<div class="gf-form">
<span class="gf-form-label">Min time interval</span>
<input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="10s"></input>
<info-popover mode="right-absolute">
A lower limit for the auto group by time interval. Recommended to be set to write frequency,
for example <code>1m</code> if your data is written every minute.
</info-popover>
</div>
</div>
</div>
<h3 class="page-heading">PostgreSQL details</h3> <h3 class="page-heading">PostgreSQL details</h3>
<div class="gf-form-group"> <div class="gf-form-group">
......
...@@ -18,5 +18,10 @@ ...@@ -18,5 +18,10 @@
"alerting": true, "alerting": true,
"annotations": true, "annotations": true,
"metrics": true "metrics": true,
"queryOptions": {
"minInterval": true
}
} }
...@@ -317,7 +317,7 @@ export class PostgresQueryCtrl extends QueryCtrl { ...@@ -317,7 +317,7 @@ export class PostgresQueryCtrl extends QueryCtrl {
case 'aggregate': case 'aggregate':
// add group by if no group by yet // add group by if no group by yet
if (this.target.group.length === 0) { if (this.target.group.length === 0) {
this.addGroup('time', '1m'); this.addGroup('time', '$__interval');
} }
let aggIndex = this.findAggregateIndex(selectParts); let aggIndex = this.findAggregateIndex(selectParts);
if (aggIndex !== -1) { if (aggIndex !== -1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment