Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] Correct dashboard "Failed Jobs Past 7 Days" metric #633

Merged
merged 1 commit into from
Jul 9, 2019
Merged

[3.0] Correct dashboard "Failed Jobs Past 7 Days" metric #633

merged 1 commit into from
Jul 9, 2019

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Jul 9, 2019

Fixes #621

option-1-week

The dashboard "Failed Jobs Past 7 Days" metric almost always shows zero because out-of-the-box the counter is actually from the past 1 hour of failed jobs. The time period label is calculated from config('horizon.trim.failed') but the Redis count query is filtered by config('horizon.trim.recent') minutes ago, same as the "Jobs Past Hour" label in the above screenshot.

This change makes the metric match the time period label so the count matches the number of results under the "Failed Jobs" page at URI /horizon/failed.

Other possible implementations

I described two other possible approaches in the issue thread: #621 (comment)

Another config/horizon.php option could be added to give devs more control over the failed job count filtered by timestamp.

Possible deprecations for Laravel Horizon 4.0+

With this merged, RedisJobRepository::countRecentlyFailed() and Redis set 'recent_failed_jobs' would no longer be used in Horizon. They could be earmarked for removal in 4.0? In the 3.0 branch, it's possible userland calls these in custom queue dashboards.

DashboardStatsController returns a count
filtered by config('horizon.trim.recent')
[default 1 hour] but the duration label is
using config('horizon.trim.failed')
[default 7 days].

Change the count to cover 7 days,
matching total rows under tab
"Failed Jobs".
@driesvints
Copy link
Member

@derekmd feel free to add the deprecated annotations

@taylorotwell taylorotwell merged commit 0169e5b into laravel:3.0 Jul 9, 2019
@derekmd derekmd deleted the dashboard-7-day-failed-job-count branch July 9, 2019 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect metric at the dashboard overview
3 participants