Skip to content

Commit

Permalink
[Monitoring] Adding metric to track time from testcase creation to bu…
Browse files Browse the repository at this point in the history
…g 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
  • Loading branch information
vitorguidi authored Nov 25, 2024
1 parent 4be8cbc commit 28eb374
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/clusterfuzz/_internal/cron/triage.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ def _check_and_update_similar_bug(testcase, issue_tracker):
return False


def _emit_bug_filing_from_testcase_elapsed_time_metric(testcase):
testcase_age = testcase.get_age_in_seconds()
monitoring_metrics.BUG_FILING_FROM_TESTCASE_ELAPSED_TIME.add(
testcase_age,
labels={
'job': testcase.job_type,
'platform': testcase.platform,
})


def _file_issue(testcase, issue_tracker, throttler):
"""File an issue for the testcase."""
logs.info(f'_file_issue for {testcase.key.id()}')
Expand Down Expand Up @@ -282,6 +292,7 @@ def _file_issue(testcase, issue_tracker, throttler):
'fuzzer_name': testcase.fuzzer_name,
'status': 'success',
})
_emit_bug_filing_from_testcase_elapsed_time_metric(testcase)
except Exception as e:
file_exception = e

Expand Down
9 changes: 9 additions & 0 deletions src/clusterfuzz/_internal/metrics/monitoring_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@
monitor.StringField('status'),
])

BUG_FILING_FROM_TESTCASE_ELAPSED_TIME = monitor.CumulativeDistributionMetric(
'fuzzed_testcase_analysis/triage_duration_secs',
description='Time elapsed between testcase and bug creation, in minutes.',
bucketer=monitor.GeometricBucketer(),
field_spec=[
monitor.StringField('job'),
monitor.StringField('platform'),
])

UNTRIAGED_TESTCASE_AGE = monitor.CumulativeDistributionMetric(
'issues/untriaged_testcase_age',
description='Age of testcases that were not yet triaged '
Expand Down

0 comments on commit 28eb374

Please sign in to comment.