client_golang/prometheus/promhttp
beorn7 586178b4ab Fix promhttp error handling
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>
2020-03-13 00:10:32 +01:00
..
delegator.go Fix promhttp error handling 2020-03-13 00:10:32 +01:00
http.go Fix promhttp error handling 2020-03-13 00:10:32 +01:00
http_test.go Add test for the new promhttp_metric_handler_errors_total metric 2019-06-06 16:56:58 +02:00
instrument_client.go Make use of pre-existing context in InstrumentRoundTripperTrace 2019-05-16 17:52:19 +02:00
instrument_client_test.go Add test to expose #580 2019-05-16 17:52:19 +02:00
instrument_server.go Take into account curried labels in promhttp 2017-12-24 14:39:06 +01:00
instrument_server_test.go Add .golangci.yml 2019-04-25 10:38:07 +02:00