Skip to content

Commit

Permalink
Correct boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Oct 9, 2023
1 parent 84139ac commit bb56dd6
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Queries/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __invoke(Interval $interval, string $orderBy): Collection

return $this->connection()->table('pulse_exceptions')
->selectRaw('class, location, COUNT(*) AS count, MAX(date) AS last_occurrence')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->groupBy('class', 'location')
->orderByDesc($orderBy)
->get();
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __invoke(Interval $interval): Collection
->select(['server', 'cpu_percent', 'memory_used', 'date'])
// Divide the data into buckets.
->selectRaw('FLOOR(UNIX_TIMESTAMP(CONVERT_TZ(`date`, ?, @@session.time_zone)) / ?) AS `bucket`', [$now->format('P'), $secondsPerPeriod])
->where('date', '>=', $now->ceilSeconds($interval->totalSeconds / $maxDataPoints)->subSeconds((int) $interval->totalSeconds)),
->where('date', '>', $now->ceilSeconds($interval->totalSeconds / $maxDataPoints)->subSeconds((int) $interval->totalSeconds)),
'grouped'
)
->groupBy('server', 'bucket')
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/SlowJobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(Interval $interval): Collection

return $this->connection()->table('pulse_jobs')
->selectRaw('`job`, SUM(slow) as count, MAX(slowest) as slowest')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('slow', '>', 0)
->groupBy('job')
->orderByDesc('slowest')
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/SlowOutgoingRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(Interval $interval): Collection

return $this->connection()->table('pulse_outgoing_requests')
->selectRaw('`uri`, COUNT(*) as count, MAX(duration) AS slowest')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('duration', '>=', $this->config->get('pulse.slow_outgoing_request_threshold'))
->groupBy('uri')
->orderByDesc('slowest')
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/SlowQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(Interval $interval): Collection

return $this->connection()->table('pulse_slow_queries')
->selectRaw('`sql`, COUNT(*) as count, MAX(duration) AS slowest')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->groupBy('sql')
->orderByDesc('slowest')
->get();
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/SlowRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __invoke(Interval $interval): Collection

return $this->connection()->table('pulse_requests')
->selectRaw('route, COUNT(*) as count, MAX(duration) AS slowest')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('duration', '>=', $this->config->get('pulse.slow_endpoint_threshold'))
->groupBy('route')
->orderByDesc('slowest')
Expand Down
2 changes: 1 addition & 1 deletion src/Queries/Usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __invoke(Interval $interval, string $type): Collection
fn (Builder $query) => $query->from('pulse_requests'))
->selectRaw('user_id, COUNT(*) as count')
->whereNotNull('user_id')
->where('date', '>=', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->where('date', '>', $now->subSeconds((int) $interval->totalSeconds)->toDateTimeString())
->when($type === 'slow_endpoint_counts',
fn (Builder $query) => $query->where('duration', '>=', $this->config->get('pulse.slow_endpoint_threshold')))
->groupBy('user_id')
Expand Down
2 changes: 1 addition & 1 deletion src/Recorders/CacheInteractions.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function normalize(string $key): string
foreach ($this->config->get('pulse.cache_keys') as $pattern => $replacement) {
$normalized = preg_replace($pattern, $replacement, $key, count: $count);

if ($count > 0) {
if ($count > 0 && $normalized !== null) {
return $normalized;
}
}
Expand Down

0 comments on commit bb56dd6

Please sign in to comment.