Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Revert "Fixing issue cachethq#3842"
Browse files Browse the repository at this point in the history
This reverts commit 3b74cd0.
  • Loading branch information
jdkemme committed Sep 3, 2020
1 parent 234823d commit 2ecfbee
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions app/Repositories/Metric/MetricRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,15 @@ public function listPointsLastHour(Metric $metric)
$points = $this->repository->getPointsSinceMinutes($metric, $nrOfMinutes + $metric->threshold)->pluck('value', 'key')->take(-$nrOfMinutes);

$timeframe = $nrOfMinutes;

//Settings counter for minutes without data
$minutesWithNoData = 0;

for ($i = 0; $i < $timeframe; $i++) {
if (!$points->has($pointKey)) {
if ($i >= $metric->threshold) {
$points->put($pointKey, $metric->default_value);
//We put default value as metric, so we can reset counter for minutes without data
$minutesWithNoData = 0;
} else {
//We didn't find any data, but threshold is not meet yet so we just adding to counter
$minutesWithNoData++;
// The point not found is still within the threshold, so it is ignored and
// the timeframe is shifted by one minute
$timeframe++;
}
} else {
//We found data within this threshold, zeroing counter
$minutesWithNoData = 0;
}

$pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('Y-m-d H:i');
Expand Down

0 comments on commit 2ecfbee

Please sign in to comment.