Browse Source

make sure opentsdb takes dashboard timezone into consideration

Marcus Efraimsson 6 years ago
parent
commit
b9c36e5301
1 changed files with 6 additions and 6 deletions
  1. 6 6
      public/app/plugins/datasource/opentsdb/datasource.ts

+ 6 - 6
public/app/plugins/datasource/opentsdb/datasource.ts

@@ -33,8 +33,8 @@ export default class OpenTsDatasource {
 
 
   // Called once per panel (graph)
   // Called once per panel (graph)
   query(options) {
   query(options) {
-    const start = this.convertToTSDBTime(options.rangeRaw.from, false);
-    const end = this.convertToTSDBTime(options.rangeRaw.to, true);
+    const start = this.convertToTSDBTime(options.rangeRaw.from, false, options.timezone);
+    const end = this.convertToTSDBTime(options.rangeRaw.to, true, options.timezone);
     const qs = [];
     const qs = [];
 
 
     _.each(options.targets, target => {
     _.each(options.targets, target => {
@@ -86,8 +86,8 @@ export default class OpenTsDatasource {
   }
   }
 
 
   annotationQuery(options) {
   annotationQuery(options) {
-    const start = this.convertToTSDBTime(options.rangeRaw.from, false);
-    const end = this.convertToTSDBTime(options.rangeRaw.to, true);
+    const start = this.convertToTSDBTime(options.rangeRaw.from, false, options.timezone);
+    const end = this.convertToTSDBTime(options.rangeRaw.to, true, options.timezone);
     const qs = [];
     const qs = [];
     const eventList = [];
     const eventList = [];
 
 
@@ -484,12 +484,12 @@ export default class OpenTsDatasource {
     });
     });
   }
   }
 
 
-  convertToTSDBTime(date, roundUp) {
+  convertToTSDBTime(date, roundUp, timezone) {
     if (date === 'now') {
     if (date === 'now') {
       return null;
       return null;
     }
     }
 
 
-    date = dateMath.parse(date, roundUp);
+    date = dateMath.parse(date, roundUp, timezone);
     return date.valueOf();
     return date.valueOf();
   }
   }
 }
 }