Skip to content

Commit

Permalink
introspection: use the response recorder
Browse files Browse the repository at this point in the history
Previously the logs were showing only 200 responses, passing
the ResponseRecorder to the handler in place of the http.ResponseWriter
should ensure that when Write() and WriteHeader() are called, the
ResponseRecorder logs information about the http response.

Backports: #1318
Signed-off-by: crozzy <joseph.crosland@gmail.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
crozzy authored and hdonnay committed Aug 5, 2021
1 parent bc60dcc commit 804cbed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion middleware/introspection/instrumentedhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func InstrumentedHandler(endpoint string, traceOpts othttp.Option, next http.Han
h = promhttp.InstrumentHandlerTimeToWriteHeader(RequestDuration, h)
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
recorder := rr.NewResponseRecorder(w)
h.ServeHTTP(w, r)
h.ServeHTTP(recorder, r)
zlog.Info(r.Context()).
Str("remote_addr", r.RemoteAddr).
Str("method", r.Method).
Expand Down

0 comments on commit 804cbed

Please sign in to comment.