[Bug 43145] New: Add Koha::Health::BackgroundJobs health check
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 Bug ID: 43145 Summary: Add Koha::Health::BackgroundJobs health check Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 43137 Target Milestone: --- Follow-up to Bug 43137 (system health monitoring framework). Adds a Koha::Health::BackgroundJobs class that checks: - Workers not picking up jobs (oldest pending job age exceeds threshold) - Failed jobs accumulating without being addressed Alert codes: - jobs_stuck: { code => 'jobs_stuck', params => { count => N, minutes => M } } - jobs_failed: { code => 'jobs_failed', params => { count => N } } Permission: { parameters => 'manage_background_jobs' } The check queries the background_jobs table for: - Jobs with status 'new' where enqueued_on is older than a configurable threshold - Jobs with status 'failed' that have not been acknowledged/cleared Should include full test coverage (mocked, not DB-dependent). Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43137 [Bug 43137] Add system health monitoring with status indicators in the staff interface -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 202253 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202253&action=edit Bug 43145: Add Koha::Health::BackgroundJobs health check Health check for the background job processing system. Detects queues where workers appear to be down by checking for pending jobs with no recent worker activity (started/finished) in the last minute. Workers poll every 10 seconds, so 1 minute without activity on a queue with pending jobs is a strong signal. Checks per-queue: - queue_no_worker: queue has pending jobs but no job started or finished recently => critical (worker likely dead) - jobs_failed: any failed jobs accumulating => warning This correctly handles: - long_tasks with a 2-hour job running: started_on is recent => healthy - default with pending jobs and no activity in 1+ min => stuck - es_indexing with backlog but recent completions => healthy (just busy) Permission: { parameters => 'manage_background_jobs' } Registered in Koha::Health->core_checks. Translation strings added to about.tt. Test plan: 1. Apply patch 2. Run: $ ktd --name bug_43137 --shell k$ prove -v t/db_dependent/Koha/Health/BackgroundJobs.t => SUCCESS: All tests pass 3. Tests cover: - Correct permission declaration - Healthy state (no pending jobs) - Pending jobs with recent activity (healthy) - Queue with no worker activity (critical) - Multiple queues, only stuck one reported - Failed jobs detection (warning) 4. Sign off :-D Assisted-by: Sonnet 4 (Anthropic) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #202253|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 202271 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202271&action=edit Bug 43145: Add Koha::Health::BackgroundJobs health check Health check for the background job processing system. Detects queues where workers appear to be down by checking for pending jobs with no recent worker activity (started/finished) in the last minute. Workers poll every 10 seconds, so 1 minute without activity on a queue with pending jobs is a strong signal. Checks per-queue: - queue_no_worker: queue has pending jobs but no job started or finished recently => critical (worker likely dead) - jobs_failed: any failed jobs accumulating => warning This correctly handles: - long_tasks with a 2-hour job running: started_on is recent => healthy - default with pending jobs and no activity in 1+ min => stuck - es_indexing with backlog but recent completions => healthy (just busy) Permission: { parameters => 'manage_background_jobs' } Registered in Koha::Health->core_checks. Translation strings added to about.tt. Test plan: 1. Apply patch 2. Run: $ ktd --name bug_43137 --shell k$ prove -v t/db_dependent/Koha/Health/BackgroundJobs.t => SUCCESS: All tests pass 3. Tests cover: - Correct permission declaration - Healthy state (no pending jobs) - Pending jobs with recent activity (healthy) - Queue with no worker activity (critical) - Multiple queues, only stuck one reported - Failed jobs detection (warning) 4. Sign off :-D Assisted-by: Sonnet 4 (Anthropic) Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org