-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(server): add queued job metrics to telemetry #24622
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
base: main
Are you sure you want to change the base?
Conversation
8b4e904 to
562be00
Compare
|
Fixed the CI errors. Now |
562be00 to
7985d13
Compare
7985d13 to
e5b2362
Compare
|
Hey @bo0tzz, thanks for your help and patience. I've added the new changes and modified the PR description to match the new implementation. You can now test it by exposing port 8081 in the Docker Compose and then running
Thanks @nicholasbergesen for the suggestion of splitting the metrics 😉 NOTE: I merged the existing implementation for "active" jobs into the one I proposed here for consistency. Also, I feel like it might be more accurate to poll in case an event is missed for whatever reason. This way we don't drag errors over time and get clean metrics every time. If you like small commits and feel like that should be a separate PR let me know, but I think this is related enough that it is ok to make this change together. |
Adds a new observable gauge `immich.queues.<queue_name>.queued` to track the number of jobs in waiting, paused, or delayed states. - Polls queue statistics every 5 seconds. - Fetches queue counts in parallel. - Only runs polling loop if job telemetry is enabled. - Includes debug logging for failed metric updates.
e5b2362 to
62994c3
Compare
|
Hi, the failing test seems to me like a flaky test unrelated to my changes. I've pulled main and rebased, in case this has been fixed there. |
nicholasbergesen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM

Description
Adds a new observable gauge
immich_queues_<queue_name>_<waiting|paused|delayed|active>to track the number of jobs in waiting, paused, delayed or active states.*_activemetrics in the gauge I created for code consistency and reliability (previously was event based).Addresses Feature Request #24615.
Related to Feature Request #11069.
Related to Issue #24520 (does not fix, but helps troubleshoot).
How Has This Been Tested?
Ran
watch -n 1 'curl -s http://localhost:8081/metrics | grep -E "^immich_queues.*_(waiting|paused|delayed|active)" | grep -v "^#"'on a separate terminal and started all available jobs on a sample library with 1000 files to observe the amount of jobs in different states change over time at the same rate as shown on the/admin/queuespage (formerlyadmin/jobs-status). The metrics refresh every 5 seconds and show the numbers as expected.Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
I am not proficient in TypeScript, especially in server code. I've used Claude Sonnet 4.5 to understand the codebase and for code suggestions and Gemini 3 Pro to run a presubmit code review and verify my changes.
I am happy to take any suggestions on best practices for TypeScript or the Immich project. Feel free to edit my PR if you believe it's necessary.