Skip to content

Commit 28eb374

Browse files
authored
[Monitoring] Adding metric to track time from testcase creation to bug filing (#4415)
### Motivation As per Chrome request, it is desirable to know how long it takes for an issue to be opened, from the moment a testcase is created. Part of #4271
1 parent 4be8cbc commit 28eb374

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/clusterfuzz/_internal/cron/triage.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,16 @@ def _check_and_update_similar_bug(testcase, issue_tracker):
254254
return False
255255

256256

257+
def _emit_bug_filing_from_testcase_elapsed_time_metric(testcase):
258+
testcase_age = testcase.get_age_in_seconds()
259+
monitoring_metrics.BUG_FILING_FROM_TESTCASE_ELAPSED_TIME.add(
260+
testcase_age,
261+
labels={
262+
'job': testcase.job_type,
263+
'platform': testcase.platform,
264+
})
265+
266+
257267
def _file_issue(testcase, issue_tracker, throttler):
258268
"""File an issue for the testcase."""
259269
logs.info(f'_file_issue for {testcase.key.id()}')
@@ -282,6 +292,7 @@ def _file_issue(testcase, issue_tracker, throttler):
282292
'fuzzer_name': testcase.fuzzer_name,
283293
'status': 'success',
284294
})
295+
_emit_bug_filing_from_testcase_elapsed_time_metric(testcase)
285296
except Exception as e:
286297
file_exception = e
287298

src/clusterfuzz/_internal/metrics/monitoring_metrics.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@
295295
monitor.StringField('status'),
296296
])
297297

298+
BUG_FILING_FROM_TESTCASE_ELAPSED_TIME = monitor.CumulativeDistributionMetric(
299+
'fuzzed_testcase_analysis/triage_duration_secs',
300+
description='Time elapsed between testcase and bug creation, in minutes.',
301+
bucketer=monitor.GeometricBucketer(),
302+
field_spec=[
303+
monitor.StringField('job'),
304+
monitor.StringField('platform'),
305+
])
306+
298307
UNTRIAGED_TESTCASE_AGE = monitor.CumulativeDistributionMetric(
299308
'issues/untriaged_testcase_age',
300309
description='Age of testcases that were not yet triaged '

0 commit comments

Comments
 (0)