Bump sigs.k8s.io/controller-runtime to v0.14.4 (#5507)
* Bump sigs.k8s.io/controller-runtime to v0.14.4 * Update gofmt
This commit is contained in:
20
vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go
generated
vendored
20
vendor/k8s.io/apiserver/pkg/server/httplog/httplog.go
generated
vendored
@@ -27,6 +27,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"k8s.io/apiserver/pkg/audit"
|
||||
"k8s.io/apiserver/pkg/endpoints/metrics"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/endpoints/responsewriter"
|
||||
@@ -59,7 +60,7 @@ type respLogger struct {
|
||||
statusRecorded bool
|
||||
status int
|
||||
statusStack string
|
||||
// mutex is used when accessing addedInfo and addedKeyValuePairs.
|
||||
// mutex is used when accessing addedInfo, addedKeyValuePairs and logStacktracePred.
|
||||
// They can be modified by other goroutine when logging happens (in case of request timeout)
|
||||
mutex sync.Mutex
|
||||
addedInfo strings.Builder
|
||||
@@ -181,6 +182,8 @@ func Unlogged(req *http.Request, w http.ResponseWriter) http.ResponseWriter {
|
||||
// StacktraceWhen sets the stacktrace logging predicate, which decides when to log a stacktrace.
|
||||
// There's a default, so you don't need to call this unless you don't like the default.
|
||||
func (rl *respLogger) StacktraceWhen(pred StacktracePred) *respLogger {
|
||||
rl.mutex.Lock()
|
||||
defer rl.mutex.Unlock()
|
||||
rl.logStacktracePred = pred
|
||||
return rl
|
||||
}
|
||||
@@ -239,17 +242,8 @@ func SetStacktracePredicate(ctx context.Context, pred StacktracePred) {
|
||||
// Log is intended to be called once at the end of your request handler, via defer
|
||||
func (rl *respLogger) Log() {
|
||||
latency := time.Since(rl.startTime)
|
||||
auditID := request.GetAuditIDTruncated(rl.req.Context())
|
||||
|
||||
verb := rl.req.Method
|
||||
if requestInfo, ok := request.RequestInfoFrom(rl.req.Context()); ok {
|
||||
// If we can find a requestInfo, we can get a scope, and then
|
||||
// we can convert GETs to LISTs when needed.
|
||||
scope := metrics.CleanScope(requestInfo)
|
||||
verb = metrics.CanonicalVerb(strings.ToUpper(verb), scope)
|
||||
}
|
||||
// mark APPLY requests and WATCH requests correctly.
|
||||
verb = metrics.CleanVerb(verb, rl.req)
|
||||
auditID := audit.GetAuditIDTruncated(rl.req.Context())
|
||||
verb := metrics.NormalizedVerb(rl.req)
|
||||
|
||||
keysAndValues := []interface{}{
|
||||
"verb", verb,
|
||||
@@ -316,6 +310,8 @@ func (rl *respLogger) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
}
|
||||
|
||||
func (rl *respLogger) recordStatus(status int) {
|
||||
rl.mutex.Lock()
|
||||
defer rl.mutex.Unlock()
|
||||
rl.status = status
|
||||
rl.statusRecorded = true
|
||||
if rl.logStacktracePred(status) {
|
||||
|
||||
Reference in New Issue
Block a user