Skip to content

Commit baa64d9

Browse files
author
p00p
committed
[yt/admin/cms] Add master_task_duration_vec metric.
* Changelog entry Type: feature Component: go-sdk Add master_task_duration_vec metric. commit_hash:4747b3721e89dea3a3f01f8fcd6ddcafe5234a66
1 parent 53d0be1 commit baa64d9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/cms/task_processor.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ type TaskProcessor struct {
340340
taskProcessingLoop metrics.Timer
341341
tasksInProcess metrics.GaugeVec
342342
gpuTasksInProcess metrics.GaugeVec
343+
masterTaskDurationVec metrics.TimerVec
343344
taskDurationVec metrics.TimerVec
344345
taskProcessingDuration metrics.Timer
345346

@@ -407,6 +408,7 @@ func (p *TaskProcessor) resetReservePool(tasks []*models.Task) {
407408
func (p *TaskProcessor) ResetLeaderMetrics() {
408409
p.reservePoolCPULimit.Set(0)
409410
p.taskDurationVec.Reset()
411+
p.masterTaskDurationVec.Reset()
410412
}
411413

412414
func (p *TaskProcessor) initRateLimiter(tasks []*models.Task) {
@@ -493,6 +495,7 @@ func (p *TaskProcessor) RegisterMetrics(r metrics.Registry) {
493495
p.taskProcessingLoop = r.Timer("task_processing_loop")
494496
p.tasksInProcess = r.GaugeVec("tasks_in_process", []string{labelAction, labelProcessingState})
495497
p.taskDurationVec = r.TimerVec("task_duration_vec", []string{labelTask, labelHost, labelProcessingState})
498+
p.masterTaskDurationVec = r.TimerVec("master_task_duration_vec", []string{labelTask, labelHost, labelProcessingState})
496499
p.gpuTasksInProcess = r.GaugeVec("gpu_tasks_in_process", []string{labelAction, labelProcessingState})
497500
p.taskProcessingDuration = r.DurationHistogram("task_processing_duration", metrics.NewDurationBuckets(
498501
time.Minute,
@@ -527,6 +530,7 @@ func (p *TaskProcessor) RegisterMetrics(r metrics.Registry) {
527530

528531
func (p *TaskProcessor) resetLoopMetrics() {
529532
p.taskDurationVec.Reset()
533+
p.masterTaskDurationVec.Reset()
530534
for _, action := range walle.HostActions {
531535
for _, state := range models.TaskProcessingStates {
532536
p.tasksInProcess.With(map[string]string{
@@ -560,6 +564,13 @@ func (p *TaskProcessor) initLoopMetrics(tasks []*models.Task) {
560564
labelHost: t.Hosts[0],
561565
labelProcessingState: string(t.ProcessingState),
562566
}).RecordDuration(time.Since(time.Time(t.CreatedAt)))
567+
if len(t.GetMasters()) > 0 {
568+
p.masterTaskDurationVec.With(map[string]string{
569+
labelTask: string(t.ID),
570+
labelHost: t.Hosts[0],
571+
labelProcessingState: string(t.ProcessingState),
572+
}).RecordDuration(time.Since(time.Time(t.CreatedAt)))
573+
}
563574
}
564575
}
565576
}

0 commit comments

Comments
 (0)