Skip to content

Commit 01c4897

Browse files
committed
Making build retrieval register as minutes
1 parent 556cd64 commit 01c4897

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/clusterfuzz/_internal/build_management/build_manager.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ def _download_and_open_build_archive(self, base_build_dir: str,
438438
try:
439439
start_time = time.time()
440440
storage.copy_file_from(build_url, build_local_archive)
441-
build_download_duration = time.time() - start_time
441+
# In minutes, as per metric definition.
442+
build_download_duration = (time.time() - start_time) / 60
442443
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
443444
build_download_duration, {
444445
'job': os.getenv('JOB_NAME'),
@@ -530,10 +531,10 @@ def _unpack_build(self,
530531
# from the build archive.
531532
list_fuzz_target_start_time = time.time()
532533
self.fuzz_targets = list(build.list_fuzz_targets())
533-
elapsed_time = time.time() - list_fuzz_target_start_time
534-
elapsed_time_in_minutes = elapsed_time / 60
534+
# In minutes, as per metric definition.
535+
elapsed_time = (time.time() - list_fuzz_target_start_time) / 60
535536
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
536-
elapsed_time_in_minutes, {
537+
elapsed_time, {
537538
'job': os.getenv('JOB_NAME'),
538539
'platform': environment.platform(),
539540
'step': 'list_fuzz_targets',
@@ -563,7 +564,8 @@ def _unpack_build(self,
563564
fuzz_target=fuzz_target_to_unpack,
564565
trusted=trusted)
565566

566-
unpack_elapsed_time = time.time() - unpack_start_time
567+
# In minutes, as per metric definition.
568+
unpack_elapsed_time = (time.time() - unpack_start_time) / 60
567569

568570
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
569571
unpack_elapsed_time, {
@@ -580,10 +582,10 @@ def _unpack_build(self,
580582
if unpack_everything:
581583
list_fuzz_target_start_time = time.time()
582584
self.fuzz_targets = list(self._get_fuzz_targets_from_dir(build_dir))
583-
elapsed_time = time.time() - list_fuzz_target_start_time
584-
elapsed_time_in_minutes = elapsed_time / 60
585+
# In minutes, as per metric definition.
586+
elapsed_listing_time = (time.time() - list_fuzz_target_start_time) / 60
585587
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
586-
elapsed_time_in_minutes, {
588+
elapsed_listing_time, {
587589
'job': os.getenv('JOB_NAME'),
588590
'platform': environment.platform(),
589591
'step': 'list_fuzz_targets',
@@ -933,7 +935,8 @@ def _unpack_custom_build(self):
933935
build_local_archive):
934936
return False
935937

936-
build_download_time = time.time() - download_start_time
938+
# In minutes, as per metric definition.
939+
build_download_time = (time.time() - download_start_time) / 60
937940
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
938941
build_download_time, {
939942
'job': os.getenv('JOB_NAME'),
@@ -961,7 +964,8 @@ def _unpack_custom_build(self):
961964
# Unpack belongs to the BuildArchive class
962965
unpack_start_time = time.time()
963966
build.unpack(self.build_dir, trusted=True)
964-
build_unpack_time = time.time() - unpack_start_time
967+
build_unpack_time = (time.time() - unpack_start_time) / 60
968+
# In minutes, as per metric definition.
965969
monitoring_metrics.JOB_BUILD_RETRIEVAL_TIME.add(
966970
build_unpack_time, {
967971
'job': os.getenv('JOB_NAME'),

src/clusterfuzz/_internal/metrics/monitoring_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'task/build_retrieval_time',
4949
bucketer=monitor.FixedWidthBucketer(width=0.05, num_finite_buckets=20),
5050
description=('Distribution of fuzz task\'s build retrieval times. '
51-
'(grouped by fuzzer/job)'),
51+
'(grouped by fuzzer/job, in minutes).'),
5252
field_spec=[
5353
monitor.StringField('job'),
5454
monitor.StringField('step'),

0 commit comments

Comments
 (0)