Преглед изворни кода

Align queries to prometheus with the step to ensure 'rate' type expressions get consistent results

Craig Miskell пре 8 година
родитељ
комит
61e6f63b32
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      public/app/plugins/datasource/prometheus/datasource.ts

+ 3 - 0
public/app/plugins/datasource/prometheus/datasource.ts

@@ -173,6 +173,9 @@ export class PrometheusDatasource {
       throw { message: 'Invalid time range' };
     }
 
+    start = start - (start % query.step);
+    end = end - (end % query.step) + query.step;
+
     var url =
       '/api/v1/query_range?query=' +
       encodeURIComponent(query.expr) +