Skip to content

Commit

Permalink
Merge pull request #1215 from Abirdcfly/master
Browse files Browse the repository at this point in the history
fix: descheduler_loop_duration_seconds has wrong value
  • Loading branch information
k8s-ci-robot authored Aug 10, 2023
2 parents 3170404 + ca57818 commit f4c64c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/descheduler/descheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ func (d *descheduler) runDeschedulerLoop(ctx context.Context, nodes []*v1.Node)
var span trace.Span
ctx, span = tracing.Tracer().Start(ctx, "runDeschedulerLoop")
defer span.End()
loopStartDuration := time.Now()
defer metrics.DeschedulerLoopDuration.With(map[string]string{}).Observe(time.Since(loopStartDuration).Seconds())
defer func(loopStartDuration time.Time) {
metrics.DeschedulerLoopDuration.With(map[string]string{}).Observe(time.Since(loopStartDuration).Seconds())
}(time.Now())

// if len is still <= 1 error out
if len(nodes) <= 1 {
Expand Down

0 comments on commit f4c64c2

Please sign in to comment.