Skip to content

Commit f4c64c2

Browse files
authored
Merge pull request #1215 from Abirdcfly/master
fix: descheduler_loop_duration_seconds has wrong value
2 parents 3170404 + ca57818 commit f4c64c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/descheduler/descheduler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ func (d *descheduler) runDeschedulerLoop(ctx context.Context, nodes []*v1.Node)
112112
var span trace.Span
113113
ctx, span = tracing.Tracer().Start(ctx, "runDeschedulerLoop")
114114
defer span.End()
115-
loopStartDuration := time.Now()
116-
defer metrics.DeschedulerLoopDuration.With(map[string]string{}).Observe(time.Since(loopStartDuration).Seconds())
115+
defer func(loopStartDuration time.Time) {
116+
metrics.DeschedulerLoopDuration.With(map[string]string{}).Observe(time.Since(loopStartDuration).Seconds())
117+
}(time.Now())
117118

118119
// if len is still <= 1 error out
119120
if len(nodes) <= 1 {

0 commit comments

Comments
 (0)