Skip to content

Commit 819e26a

Browse files
Weiwei Yangchanglan
authored andcommitted
Remove the labels from job run latency histogram metrics
GitOrigin-RevId: 82aee74
1 parent 41887e1 commit 819e26a

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

axlearn/cloud/common/metrics.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
BASTION_DOWNLOAD_JOB_ALL_SECONDS = Histogram(
1010
"bastion_download_job_all_seconds",
1111
"Time in seconds consumed in each scheduling loop to download all the job specs",
12-
[],
1312
buckets=(1, 5, 10, 30, 60, 120, 300, 600, 1800, 3600), # 1s to 1hr
1413
)
1514

1615
JOB_TIME_TO_RUNNING_SECONDS = Histogram(
1716
"bastion_job_time_to_running_seconds",
1817
"Time in seconds from runner starts a job until until it reaches Running state",
19-
["job_name"],
2018
buckets=(1, 5, 10, 30, 60, 120, 300, 600, 1800, 3600), # 1s to 1hr
2119
)
2220

@@ -35,7 +33,6 @@
3533
JOB_SUSPENDED_DURATION_SECONDS = Histogram(
3634
"bastion_job_suspended_duration_seconds",
3735
"Time in seconds the jobset stayed in SUSPENDED state",
38-
["job_name"],
3936
buckets=(1, 5, 10, 30, 60, 120, 300, 600, 1800, 3600), # 1s to 1hr
4037
)
4138

@@ -115,15 +112,14 @@ def get_multiprocess_dir(cls) -> str:
115112
return cls._multiprocess_dir
116113

117114

118-
def record_job_time_to_running(job_name: str, time_seconds: float):
115+
def record_job_time_to_running(time_seconds: float):
119116
"""Record the time it took for a job to reach RUNNING state.
120117
121118
Args:
122119
job_name: Name of the job
123120
time_seconds: Time in seconds from first seen until RUNNING state
124121
"""
125-
JOB_TIME_TO_RUNNING_SECONDS.labels(job_name=job_name).observe(time_seconds)
126-
logging.info("Metrics: job %s took %.2f seconds to reach RUNNING state", job_name, time_seconds)
122+
JOB_TIME_TO_RUNNING_SECONDS.observe(time_seconds)
127123

128124

129125
def record_job_run_latency(job_name: str, time_seconds: float):
@@ -141,15 +137,14 @@ def record_job_wait_for_build(job_name: str, time_seconds: float):
141137
JOB_WAIT_FOR_BUILD_SECONDS.labels(job_name).set(time_seconds)
142138

143139

144-
def record_job_suspended_duration(job_name: str, time_seconds: float):
140+
def record_job_suspended_duration(time_seconds: float):
145141
"""Record the time a job spent in SUSPENDED state.
146142
147143
Args:
148144
job_name: Name of the job
149145
time_seconds: Time in seconds the job was in SUSPENDED state
150146
"""
151-
JOB_SUSPENDED_DURATION_SECONDS.labels(job_name=job_name).observe(time_seconds)
152-
logging.info("Metrics: job %s was in SUSPENDED state for %.2f seconds", job_name, time_seconds)
147+
JOB_SUSPENDED_DURATION_SECONDS.observe(time_seconds)
153148

154149

155150
def cleanup(pid=None):

axlearn/cloud/gcp/runners/gke.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def _execute(self):
659659
if suspended_since is not None:
660660
# Job exited SUSPENDED state, record the duration.
661661
suspended_duration = time.perf_counter() - suspended_since
662-
metrics.record_job_suspended_duration(cfg.name, suspended_duration)
662+
metrics.record_job_suspended_duration(suspended_duration)
663663
suspended_since = None
664664

665665
# Ensure VertexAI Tensorboard Uploader is running.
@@ -670,7 +670,7 @@ def _execute(self):
670670
if status == GKERunnerJob.Status.READY and status != last_job_status:
671671
# Record the time to reach RUNNING state.
672672
elapsed_time = time.perf_counter() - start_time
673-
metrics.record_job_time_to_running(cfg.name, elapsed_time)
673+
metrics.record_job_time_to_running(elapsed_time)
674674
metrics.record_job_run_latency(cfg.name, elapsed_time)
675675
self._maybe_publish(
676676
cfg.name, msg="Job is running", state=JobLifecycleState.RUNNING

0 commit comments

Comments
 (0)