Commit Graph

18 Commits

Author SHA1 Message Date
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
beorn7 57d41259e1 Add exemplars to counter and histogram
Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-24 17:12:08 +01:00
beorn7 3fa9fca2cb Add an error counter for internal errors in the HTTP handler
The doc comments explain the rationale in a quite detailed way.

Fixes #543 and #542

Signed-off-by: beorn7 <beorn@grafana.com>
2019-06-05 20:07:49 +02:00
beorn7 a006a7550a Remove unused constants and fields
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-24 11:22:57 +01:00
beorn7 62361fc0fb Use streaming encoding of metrics
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-22 01:04:52 +02:00
glefloch c2c6fd2ab4 Fix PR comments
Signed-off-by: glefloch <glfloch@gmail.com>
2018-10-19 13:51:45 +02:00
glefloch fdf4cbc87b Use sync.Pool for gzipWriter
Signed-off-by: glefloch <glfloch@gmail.com>
2018-10-17 13:17:33 +02:00
Karsten Weiss d7590aab3c Fix three shadow variable warnings (govet -shadow)
Fixes:
http.go:118: declaration of "part" shadows declaration at http.go:117
http_test.go:50: declaration of "respBody" shadows declaration at http_test.go:25
promhttp/http.go:305: declaration of "part" shadows declaration at promhttp/http.go:304

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Brian Brazil 02aee00fdb
Fix a typo 2018-02-14 11:10:46 +00:00
beorn7 c551c3c661 promhttp: Introduce limit for connections in flight and timeout 2018-02-09 17:05:10 +01:00
beorn7 8fd47d2e8f Provide an InstrumentedHandler
See https://github.com/prometheus/client_golang/issues/316 for details.
2018-02-08 16:27:51 +01:00
beorn7 2cb8df16e3 Fix error reporting bug
That's the same bug fixed in #342 (which is the deprecated code only
replicated in the `prometheus` package until v0.10 is out).
2017-08-31 15:10:58 +02:00
stuart nelson d300d5cf21 Instrument RoundTripper via middleware (#295)
Instrument RoundTripper via middleware
2017-05-09 18:46:09 +02:00
stuart nelson d01fd62222 new handler instrumentation (#285)
Add new HTTP handler instrumentation
2017-04-24 15:13:19 -04:00
beorn7 390e874a3f Fix doc comment typo 2016-08-15 15:54:18 +02:00
beorn7 1dc03a72f6 Replace hashicorp/go-multierror by own implementation
The own implementation is much easier as it only has to serve our one
use case.
2016-08-04 16:03:06 +02:00
beorn7 f0c45acc50 Rename Deliver into Gather 2016-08-04 15:26:27 +02:00
beorn7 bc0b2a3b17 Move http stuff in its own package promhttp
To keep backwards compatibility while not creating circular import
chains, some code had to be duplicated. But all functions using it
have been declared deprecated hereby.

The new ways of instrumenting handlers will all go into the new
package, and ultimately, the prometheus package itself will be
completely igorant of HTTP.
2016-08-03 18:06:48 +02:00