Ver Fonte

Merge branch 'prometheus-fix_step_calculation' of https://github.com/dan-cleinmark/grafana into dan-cleinmark-prometheus-fix_step_calculation

Torkel Ödegaard há 10 anos atrás
pai
commit
59fc72d37e
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      public/app/plugins/datasource/prometheus/datasource.js

+ 3 - 3
public/app/plugins/datasource/prometheus/datasource.js

@@ -99,11 +99,11 @@ function (angular, _, moment, dateMath) {
       var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end;
       var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end;
 
 
       var step = query.step;
       var step = query.step;
-      var range = Math.floor(end - start);
+      var range = Math.ceil(end - start);
       // Prometheus drop query if range/step > 11000
       // Prometheus drop query if range/step > 11000
       // calibrate step if it is too big
       // calibrate step if it is too big
       if (step !== 0 && range / step > 11000) {
       if (step !== 0 && range / step > 11000) {
-        step = Math.floor(range / 11000);
+        step = Math.ceil(range / 11000);
       }
       }
       url += '&step=' + step;
       url += '&step=' + step;
 
 
@@ -212,7 +212,7 @@ function (angular, _, moment, dateMath) {
         sec = 1;
         sec = 1;
       }
       }
 
 
-      return Math.floor(sec * intervalFactor) + 's';
+      return Math.ceil(sec * intervalFactor) + 's';
     };
     };
 
 
     function transformMetricData(md, options) {
     function transformMetricData(md, options) {