mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Merge pull request #14209 from bboreham/api-error-url
[ENHANCEMENT] HTTP API: Add url to errors logged while sending response
This commit is contained in:
commit
64c5cc5134
|
@ -1761,7 +1761,7 @@ func (api *API) respond(w http.ResponseWriter, req *http.Request, data interface
|
||||||
|
|
||||||
b, err := codec.Encode(resp)
|
b, err := codec.Encode(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(api.logger).Log("msg", "error marshaling response", "err", err)
|
level.Error(api.logger).Log("msg", "error marshaling response", "url", req.URL, "err", err)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1769,7 +1769,7 @@ func (api *API) respond(w http.ResponseWriter, req *http.Request, data interface
|
||||||
w.Header().Set("Content-Type", codec.ContentType().String())
|
w.Header().Set("Content-Type", codec.ContentType().String())
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
if n, err := w.Write(b); err != nil {
|
if n, err := w.Write(b); err != nil {
|
||||||
level.Error(api.logger).Log("msg", "error writing response", "bytesWritten", n, "err", err)
|
level.Error(api.logger).Log("msg", "error writing response", "url", req.URL, "bytesWritten", n, "err", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue