Commit f547f0ce authored by Paul Asmuth's avatar Paul Asmuth
Browse files

pad timeseries data window by aggregation window

parent a65e7b6a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -61,9 +61,16 @@ void TimeseriesQuery::run(
  from_ = from;
  until_ = until;

  auto from_with_padding = from.unixMicros();
  if (aggr_fn != AggregationFunction::kNoAggregation) {
    if (from_with_padding > aggr_window.microseconds()) {
      from_with_padding -= aggr_window.microseconds();
    }
  }

  metric_service->scanSamples(
      metric_key,
      from,
      DateTime(from_with_padding),
      until,
      [this] (Sample* sample) -> bool {
        processSample(sample, false);