Skip to content

Commit 74797c2

Browse files
authored
Adding test case reproducibility metric (#4358)
### Motivation The Chrome team has no easy visibility into how many manually uploaded test cases flake or successfully reproduce. This PR implements a counter metric to track that. There are three possible outcomes, each represented by a string label: 'reproduces', 'one_timer' and 'does_not_reproduce' Part of #4271
1 parent 13c5b09 commit 74797c2

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from clusterfuzz._internal.datastore import data_types
3535
from clusterfuzz._internal.fuzzing import leak_blacklist
3636
from clusterfuzz._internal.metrics import logs
37+
from clusterfuzz._internal.metrics import monitoring_metrics
3738
from clusterfuzz._internal.protos import uworker_msg_pb2
3839
from clusterfuzz._internal.system import environment
3940

@@ -409,6 +410,14 @@ def utask_main(uworker_input):
409410
analyze_task_output.crash_stacktrace = testcase.crash_stacktrace
410411

411412
if not crashed:
413+
monitoring_metrics.ANALYZE_TASK_REPRODUCIBILITY.increment(
414+
labels={
415+
'fuzzer_name': uworker_input.fuzzer_name,
416+
'job': uworker_input.job_type,
417+
'crashes': False,
418+
'reproducible': False,
419+
'platform': environment.platform(),
420+
})
412421
return uworker_msg_pb2.Output( # pylint: disable=no-member
413422
analyze_task_output=analyze_task_output,
414423
error_type=uworker_msg_pb2.ErrorType.ANALYZE_NO_CRASH, # pylint: disable=no-member
@@ -425,7 +434,18 @@ def utask_main(uworker_input):
425434

426435
test_for_reproducibility(fuzz_target, testcase, testcase_file_path, state,
427436
test_timeout)
428-
analyze_task_output.one_time_crasher_flag = testcase.one_time_crasher_flag
437+
one_time_flag = testcase.one_time_crasher_flag
438+
439+
analyze_task_output.one_time_crasher_flag = one_time_flag
440+
441+
monitoring_metrics.ANALYZE_TASK_REPRODUCIBILITY.increment(
442+
labels={
443+
'fuzzer_name': uworker_input.fuzzer_name,
444+
'job': uworker_input.job_type,
445+
'crashes': True,
446+
'reproducible': not one_time_flag,
447+
'platform': environment.platform(),
448+
})
429449

430450
fuzz_target_metadata = engine_common.get_fuzz_target_issue_metadata(
431451
fuzz_target)

src/clusterfuzz/_internal/metrics/monitoring_metrics.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,13 @@
250250
monitor.StringField('fuzzer_name'),
251251
monitor.StringField('status'),
252252
])
253+
254+
ANALYZE_TASK_REPRODUCIBILITY = monitor.CounterMetric(
255+
'task/analyze/reproducibility',
256+
description='Outcome count for analyze task.',
257+
field_spec=[
258+
monitor.StringField('job'),
259+
monitor.StringField('fuzzer_name'),
260+
monitor.BooleanField('reproducible'),
261+
monitor.BooleanField('crashes'),
262+
])

0 commit comments

Comments
 (0)