diff --git a/src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py b/src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py index b8d8f0f663..50a2e07be7 100644 --- a/src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py +++ b/src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py @@ -83,6 +83,7 @@ def __init__(self, subtask: _Subtask): self.start_time_ns = time.time_ns() self._subtask = subtask self._labels = None + self._trimmed_labels = None self.utask_main_failure = None self._utask_success_conditions = [ None, # This can be a successful return value in, ie, fuzz task @@ -177,10 +178,11 @@ def __exit__(self, _exc_type, _exc_value, _traceback): # Get rid of job as a label, so we can have another metric to make # error conditions more explicit, respecting the 30k distinct # labels limit recommended by gcp. - trimmed_labels = self._labels + trimmed_labels = { + **self._labels, 'task_succeeded': task_succeeded, + 'error_condition': error_condition + } del trimmed_labels['job'] - trimmed_labels['task_succeeded'] = task_succeeded - trimmed_labels['error_condition'] = error_condition monitoring_metrics.TASK_OUTCOME_COUNT_BY_ERROR_TYPE.increment( trimmed_labels)