Skip to content

Commit 187b18d

Browse files
authored
Logging successful task executions in utask _MetricRecorder (#4492)
### Motivation Progression task was failing 100% of the time due to an unhandled exception. This PR adds further logging so we can confirm if this is the case. This also makes UNTRIAGED_TESTCASE_AGE and TESTCASE_UPLOAD_TRIAGE_DURATION in hours, instead of seconds, for better readability
1 parent daef7ff commit 187b18d

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/clusterfuzz/_internal/bot/tasks/utasks/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ def __exit__(self, _exc_type, _exc_value, _traceback):
166166
monitoring_metrics.TASK_OUTCOME_COUNT_BY_ERROR_TYPE.increment(
167167
trimmed_labels)
168168

169+
if error_condition != 'UNHANDLED_EXCEPTION':
170+
task = self._labels['task']
171+
subtask = self._labels['subtask']
172+
logs.info(f'Task {task}, at subtask {subtask}, finished successfully.')
173+
169174

170175
def ensure_uworker_env_type_safety(uworker_env):
171176
"""Converts all values in |uworker_env| to str types.

src/clusterfuzz/_internal/common/testcase_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def emit_testcase_triage_duration_metric(testcase_id: int, step: str):
4747
]
4848
elapsed_time_since_upload = datetime.datetime.utcnow()
4949
elapsed_time_since_upload -= testcase_upload_metadata.timestamp
50-
elapsed_time_since_upload = elapsed_time_since_upload.total_seconds()
50+
elapsed_time_since_upload = elapsed_time_since_upload.total_seconds() / 3600
5151

5252
testcase = data_handler.get_testcase_by_id(testcase_id)
5353

src/clusterfuzz/_internal/cron/triage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def _emit_untriaged_testcase_age_metric(critical_tasks_completed: bool,
320320
logs.info(f'Emiting UNTRIAGED_TESTCASE_AGE for testcase {testcase.key.id()} '
321321
f'(age = {testcase.get_age_in_seconds()})')
322322
monitoring_metrics.UNTRIAGED_TESTCASE_AGE.add(
323-
testcase.get_age_in_seconds(),
323+
testcase.get_age_in_seconds() / 3600,
324324
labels={
325325
'job': testcase.job_type,
326326
'platform': testcase.platform,

src/clusterfuzz/_internal/metrics/monitoring_metrics.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@
234234
TESTCASE_UPLOAD_TRIAGE_DURATION = monitor.CumulativeDistributionMetric(
235235
'uploaded_testcase_analysis/triage_duration_secs',
236236
description=('Time elapsed between testcase upload and completion'
237-
' of relevant tasks in the testcase upload lifecycle.'),
237+
' of relevant tasks in the testcase upload lifecycle, '
238+
'in hours.'),
238239
bucketer=monitor.GeometricBucketer(),
239240
field_spec=[
240241
monitor.StringField('step'),
@@ -357,7 +358,7 @@
357358
'issues/untriaged_testcase_age',
358359
description='Age of testcases that were not yet triaged '
359360
'(have not yet completed analyze, regression,'
360-
' minimization, impact task), in seconds.',
361+
' minimization, impact task), in hours.',
361362
bucketer=monitor.GeometricBucketer(),
362363
field_spec=[
363364
monitor.StringField('job'),

0 commit comments

Comments
 (0)