Merge pull request #105403 from tkashem/add-watch-init-latency

apf: print watch initialization latency in httplog
This commit is contained in:
Kubernetes Prow Robot 2021-10-06 17:42:41 -07:00 committed by GitHub
commit 5c3a789ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ import (
"net/http"
"runtime"
"sync/atomic"
"time"
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
apitypes "k8s.io/apimachinery/pkg/types"
@ -176,6 +177,10 @@ func WithPriorityAndFairness(
}()
execute := func() {
startedAt := time.Now()
defer func() {
httplog.AddKeyValue(ctx, "apf_init_latency", time.Now().Sub(startedAt))
}()
noteExecutingDelta(1)
defer noteExecutingDelta(-1)
served = true