fix(taskworker): Improve Queue Size Metrics#612
Conversation
| pod_name: str | None = None, | ||
| process_type: str = "spawn", | ||
| health_check_file_path: str | None = None, | ||
| health_check_sec_per_touch: float = DEFAULT_WORKER_HEALTH_CHECK_SEC_PER_TOUCH, |
There was a problem hiding this comment.
Bug: The TaskWorker class does not accept a pod_name parameter, causing queue size metrics to be incorrectly tagged with pod_name="unknown".
Severity: MEDIUM
Suggested Fix
Update the TaskWorker.__init__ method to accept a pod_name parameter and pass it to the TaskWorkerProcessingPool constructor, similar to how PushTaskWorker handles it.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: clients/python/src/taskbroker_client/worker/worker.py#L130-L133
Potential issue: The `TaskWorker` class, used for pull-mode workers, does not accept a
`pod_name` parameter in its `__init__` method. Consequently, it cannot pass the pod name
when it instantiates `TaskWorkerProcessingPool`. The `TaskWorkerProcessingPool` then
defaults the `pod_name` to `"unknown"`. This results in all queue size metrics for
pull-mode workers being tagged with `pod_name="unknown"`, making it difficult to monitor
queue sizes on a per-pod basis for this worker type.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
I don't care about pull workers.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8d8f444. Configure here.
| child_tasks_queue_maxsize=child_tasks_queue_maxsize, | ||
| result_queue_maxsize=result_queue_maxsize, | ||
| processing_pool_name=processing_pool_name, | ||
| pod_name=pod_name, |
There was a problem hiding this comment.
TaskWorker missing pod_name parameter for metrics tagging
Medium Severity
The new pod_name parameter was added to PushTaskWorker and plumbed through to TaskWorkerProcessingPool, but the TaskWorker class (PULL mode) was not updated. Since TaskWorkerProcessingPool.result_thread now emits gauge metrics tagged with pod_name, all PULL-mode workers will always report pod_name="unknown", defeating the PR's goal of per-pod metric visibility for those workers.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8d8f444. Configure here.
There was a problem hiding this comment.
I don't care about pull workers.
evanh
left a comment
There was a problem hiding this comment.
Approved as is but would be better if pod name can be automatically added.
Agreed, will look into this in the future. |


Linear
Completes STREAM-910
Description
PushTaskRPC endpoint, which means if a worker isn't being used, it won't be emitting its queue size metrics, giving us no insight into idle workersThis PR fixes those things 💪