Explorar el Código

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

Craig Miskell hace 8 años
padre
commit
61e6f63b32
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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' };
       throw { message: 'Invalid time range' };
     }
     }
 
 
+    start = start - (start % query.step);
+    end = end - (end % query.step) + query.step;
+
     var url =
     var url =
       '/api/v1/query_range?query=' +
       '/api/v1/query_range?query=' +
       encodeURIComponent(query.expr) +
       encodeURIComponent(query.expr) +