Skip to content

Commit 62269bb

Browse files
committed
change(influxdb): always specify absolute time range in milliseconds, refactoring grafana#6571
1 parent c6bb86d commit 62269bb

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

public/app/plugins/datasource/influxdb/datasource.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,9 @@ export default class InfluxDatasource {
250250
};
251251

252252
getTimeFilter(options) {
253-
var inMS = elapsed < (5 * 60000);
254-
255-
var from = this.getInfluxTime(options.rangeRaw.from, false, inMS);
256-
var until = this.getInfluxTime(options.rangeRaw.to, true, inMS);
257-
var fromIsAbsolute = from[from.length-1] === 's';
253+
var from = this.getInfluxTime(options.rangeRaw.from, false);
254+
var until = this.getInfluxTime(options.rangeRaw.to, true);
255+
var fromIsAbsolute = from[from.length-1] === 'ms';
258256

259257
if (until === 'now()' && !fromIsAbsolute) {
260258
return 'time > ' + from;
@@ -263,7 +261,7 @@ export default class InfluxDatasource {
263261
return 'time > ' + from + ' and time < ' + until;
264262
}
265263

266-
getInfluxTime(date, roundUp, inMS) {
264+
getInfluxTime(date, roundUp) {
267265
if (_.isString(date)) {
268266
if (date === 'now') {
269267
return 'now()';
@@ -278,10 +276,7 @@ export default class InfluxDatasource {
278276
date = dateMath.parse(date, roundUp);
279277
}
280278

281-
if (inMS) {
282-
return date.valueOf() + 'ms';
283-
}
284-
return (date.valueOf() / 1000).toFixed(0) + 's';
279+
return date.valueOf() + 'ms';
285280
}
286281
}
287282

0 commit comments

Comments
 (0)