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)