Skip to content

Commit

Permalink
Merge pull request kubernetes#109109 from mborsz/exec_time
Browse files Browse the repository at this point in the history
Add apf_execution_time log field.
  • Loading branch information
k8s-ci-robot authored Apr 8, 2022
2 parents 9984048 + 488a191 commit 7380fc7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"strconv"
"time"

"k8s.io/apiserver/pkg/server/httplog"
"k8s.io/apiserver/pkg/server/mux"
fq "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing"
"k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/eventclock"
Expand Down Expand Up @@ -186,7 +187,9 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque
executed = true
startExecutionTime := time.Now()
defer func() {
metrics.ObserveExecutionDuration(ctx, pl.Name, fs.Name, time.Since(startExecutionTime))
executionTime := time.Since(startExecutionTime)
httplog.AddKeyValue(ctx, "apf_execution_time", executionTime)
metrics.ObserveExecutionDuration(ctx, pl.Name, fs.Name, executionTime)
}()
execFn()
})
Expand Down

0 comments on commit 7380fc7

Please sign in to comment.