Revert "Generate Stack Traces for http response with status code zero"
Does not help with the bug investigation. the http server is designed to panic when the http status code is `0`. This reverts commit 72792d59f46f822cf360e797d886e582a6a2dc60. Kubernetes-commit: 85ae15621af1d71caf5d0bac2299d17ec1020664
This commit is contained in:
parent
3b195c4701
commit
e2884e1186
|
|
@ -25,17 +25,6 @@ import (
|
||||||
"k8s.io/apiserver/pkg/server/httplog"
|
"k8s.io/apiserver/pkg/server/httplog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func badHTTPResponse() httplog.StacktracePred {
|
|
||||||
return func(status int) bool {
|
|
||||||
// http status code should not be zero
|
|
||||||
if status == 0 {
|
|
||||||
klog.Errorf("Bad HTTP Response - status is zero")
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithPanicRecovery wraps an http Handler to recover and log panics.
|
// WithPanicRecovery wraps an http Handler to recover and log panics.
|
||||||
func WithPanicRecovery(handler http.Handler) http.Handler {
|
func WithPanicRecovery(handler http.Handler) http.Handler {
|
||||||
return withPanicRecovery(handler, func(w http.ResponseWriter, req *http.Request, err interface{}) {
|
return withPanicRecovery(handler, func(w http.ResponseWriter, req *http.Request, err interface{}) {
|
||||||
|
|
@ -50,7 +39,7 @@ func withPanicRecovery(handler http.Handler, crashHandler func(http.ResponseWrit
|
||||||
crashHandler(w, req, err)
|
crashHandler(w, req, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
logger := httplog.NewLogged(req, &w).StacktraceWhen(badHTTPResponse())
|
logger := httplog.NewLogged(req, &w)
|
||||||
defer logger.Log()
|
defer logger.Log()
|
||||||
|
|
||||||
// Dispatch to the internal handler
|
// Dispatch to the internal handler
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue