From 82be6244d7b1fc42e4821a1bd05101f29eb3c97d Mon Sep 17 00:00:00 2001 From: Ben McKerry <110857332+bmckerry@users.noreply.github.com> Date: Wed, 3 Jun 2026 14:31:22 -0400 Subject: [PATCH] ref(workerchild): add distribution metric for pending futures --- .../python/src/taskbroker_client/worker/workerchild.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clients/python/src/taskbroker_client/worker/workerchild.py b/clients/python/src/taskbroker_client/worker/workerchild.py index ab80744e..d56ab753 100644 --- a/clients/python/src/taskbroker_client/worker/workerchild.py +++ b/clients/python/src/taskbroker_client/worker/workerchild.py @@ -285,6 +285,16 @@ def await_task_futures(task: ActivationWithPendingFutures) -> None: def check_task_future_completion() -> None: if len(pending_task_futures) > 0: + # Records a distribution of how many activations with pending producer futures + # a processing pool has across all worker child processes. + # Only reports if the worker actually has pending futures. + metrics.distribution( + "taskworker.worker.activations_with_pending_futures", + len(pending_task_futures), + tags={ + "processing_pool": processing_pool_name, + }, + ) for task in pending_task_futures.copy(): if all([f.done() for f in task.pending_futures]): await_task_futures(task)