forked from mirror/client_golang
586178b4ab
Essentially, just don't try to set a status code and send any error message in the body once metrics gathering has succeeded. At that point, the most likely reason for errors is anyway that the client has disconnected, in which sending an error is moot. The other possible reason for an error is a problem during metrics encoding. This is unlikely to happen (it's a coding error here in client_golang in any case), and if it is happening, the odds are we have already sent something to the ResponseWriter, which means we cannot set a status code anymore. The doc comment for HTTPErrorOnError now describes these circumstances explicitly and recommends to set a logger to report that kind of error. This should fix the reason for the infamous `superfluous response.WriteHeader call` message. Signed-off-by: beorn7 <beorn@grafana.com> |
||
---|---|---|
.. | ||
delegator.go | ||
http.go | ||
http_test.go | ||
instrument_client.go | ||
instrument_client_test.go | ||
instrument_server.go | ||
instrument_server_test.go |