Skip to content

Commit

Permalink
Fix trimmed labels being used in other metrics, due to shallow copy
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorguidi committed Jan 8, 2025
1 parent 568cb55 commit 2254e7c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 2254e7c

Please sign in to comment.