diff --git a/charts/radix-operator/Chart.yaml b/charts/radix-operator/Chart.yaml index c0938d092..55b938118 100644 --- a/charts/radix-operator/Chart.yaml +++ b/charts/radix-operator/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: radix-operator -version: 1.37.8 -appVersion: 1.57.16 +version: 1.37.9 +appVersion: 1.57.17 kubeVersion: ">=1.24.0" description: Radix Operator keywords: diff --git a/pkg/apis/utils/http/log.go b/pkg/apis/utils/http/log.go index ed9186ef4..3c43c0bb8 100644 --- a/pkg/apis/utils/http/log.go +++ b/pkg/apis/utils/http/log.go @@ -11,14 +11,21 @@ import ( // http.RoundTripper to observe the request duration func LogRequests(t http.RoundTripper) http.RoundTripper { return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - logger := log.Ctx(r.Context()).With(). - Str("method", r.Method). - Str("path", r.URL.Path). - Logger() + ev := log.Ctx(r.Context()).Trace().Str("method", r.Method) + if r.URL != nil { + ev = ev.Str("path", r.URL.Path) + } start := time.Now() resp, err := t.RoundTrip(r) - elapsedMs := time.Since(start).Milliseconds() - logger.Trace().Err(err).Int64("elapsed_ms", elapsedMs).Int("status", resp.StatusCode).Msg(http.StatusText(resp.StatusCode)) + ev = ev.Int64("elapsed_ms", time.Since(start).Milliseconds()) + var msg string + if err == nil { + msg = http.StatusText(resp.StatusCode) + ev = ev.Int("status", resp.StatusCode) + } else { + ev = ev.Err(err) + } + ev.Msg(msg) return resp, err }) }