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.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
  • Loading branch information
crozzy committed Jul 20, 2021
1 parent 72df357 commit 8d12890
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 8d12890

Please sign in to comment.