enhance: compaction task metric bug (#44280)

issue: #44281

Signed-off-by: yusheng.ma <yushengma@bytedance.com>
Co-authored-by: yusheng.ma <yushengma@bytedance.com>
This commit is contained in:
presburger 2025-09-17 10:06:01 +08:00 committed by GitHub
parent 7ef76058d5
commit d44bdcd76c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -334,13 +334,14 @@ func (c *compactionPlanHandler) schedule() []CompactionTask {
} }
} }
c.executingTasks[t.GetTaskProto().GetPlanID()] = t c.executingTasks[t.GetTaskProto().GetPlanID()] = t
metrics.DataCoordCompactionTaskNum.WithLabelValues(fmt.Sprintf("%d", NullNodeID), t.GetTaskProto().GetType().String(), metrics.Pending).Dec()
metrics.DataCoordCompactionTaskNum.WithLabelValues(fmt.Sprintf("%d", t.GetTaskProto().GetNodeID()), t.GetTaskProto().GetType().String(), metrics.Executing).Inc()
if len(c.executingTasks) >= parallelism { if len(c.executingTasks) >= parallelism {
c.executingGuard.Unlock() c.executingGuard.Unlock()
break // 2. the parallelism of running tasks is reached break // 2. the parallelism of running tasks is reached
} }
c.executingGuard.Unlock() c.executingGuard.Unlock()
metrics.DataCoordCompactionTaskNum.WithLabelValues(fmt.Sprintf("%d", NullNodeID), t.GetTaskProto().GetType().String(), metrics.Pending).Dec()
metrics.DataCoordCompactionTaskNum.WithLabelValues(fmt.Sprintf("%d", t.GetTaskProto().GetNodeID()), t.GetTaskProto().GetType().String(), metrics.Executing).Inc()
} }
return selected return selected
} }