Просмотр исходного кода

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

Craig Miskell 8 лет назад
Родитель
Сommit
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) +