Skip to content

feat: report how long the longest-running job in each queue has been running - #153

Merged
adamlogic merged 1 commit into
mainfrom
adam/jdo-1621-busy-time
Nov 18, 2026
Merged

adamlogic merged 1 commit into
mainfrom
adam/jdo-1621-busy-time

Conversation

@adamlogic

Copy link
Copy Markdown
Member

Refs JDO-1621.

RQ and Celery now report bt (busy time) per queue alongside busy: how long the longest-running job has been running, in milliseconds, or 0 when nothing is running. It is reported only when TRACK_BUSY_JOBS is on, and is omitted whenever busy is omitted. This matches judoscale-ruby#283.

  • Celery: uses time_start from the inspect().active() call we already make (absolute epoch seconds since Celery 4.4), so there are no extra calls. Tasks the pool hasn't accepted yet have no time_start and are skipped.
  • RQ: reads unexpired started-registry entries with ZRANGEBYSCORE (still read-only, replacing ZCOUNT), then pipelines an HGET started_at for each job. RQ 2 stores <job_id>:<execution_id> entries and RQ 1 stores job IDs; both are handled. RQ 1 parses started_at to a naive datetime, so it is marked UTC explicitly.

Dramatiq still doesn't support busy jobs. The Judoscale API already ingests bt (judoscale/judoscale@f4973f0), and older API versions drop unknown metric types.

Tests

  • Collector tests cover the oldest start winning, unaccepted Celery tasks, RQ 1 and 2 registry entries, and 0 when nothing is running.
  • I also checked against real RQ and Celery workers on Redis: bt matched how long the jobs had been running.
  • pytest passes with the poetry.lock versions, and black is clean.

@adamlogic
adamlogic merged commit aa1a767 into main Nov 18, 2026
5 checks passed
@adamlogic
adamlogic deleted the adam/jdo-1621-busy-time branch November 18, 2026 16:34
adamlogic pushed a commit that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.17.0](v1.16.0...v1.17.0)
(2026-11-18)


### Features

* report how long the longest-running job in each queue has been running
([#153](#153))
([aa1a767](aa1a767))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants