client_golang/prometheus
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
..
graphite fix tests 2019-10-23 00:15:54 +05:00
internal Create an internal package 2018-09-03 00:18:11 +02:00
promauto Add NewUntypedFunc to promauto 2020-02-13 22:08:18 +01:00
promhttp Fix promhttp error handling 2020-03-13 00:10:32 +01:00
push Use HTTP status code constants rather than numerical literals 2019-10-14 19:27:09 +02:00
testutil Added testutil.CollectAndCount 2020-01-09 11:20:19 +00:00
.gitignore Rearrange file and package per convention. 2013-04-04 15:27:09 +02:00
README.md Create a public registry interface and separate out HTTP exposition 2016-08-02 18:46:22 +02:00
benchmark_test.go Add a benchmark for concurrent counter increments 2018-01-19 15:15:10 -08:00
build_info.go Add a simple buildInfoCollector 2019-06-06 22:24:23 +02:00
build_info_pre_1.12.go Add a simple buildInfoCollector 2019-06-06 22:24:23 +02:00
collector.go fix typo 2019-01-04 21:14:10 +01:00
collector_test.go Add a DescribeByCollect helper 2018-09-05 14:10:51 +02:00
counter.go Initialize now fn for counters 2020-02-05 22:25:47 -08:00
counter_test.go Add tests for examplars 2020-01-24 17:12:36 +01:00
desc.go Move registry hashing to xxhash 2019-10-14 21:18:38 +02:00
desc_test.go Add missing license headers 2018-08-22 13:53:56 +02:00
doc.go Remove obsolete references to `Untyped` from doc comments 2020-02-13 22:03:05 +01:00
example_clustermanager_test.go Nitpicking a doc comment 2018-11-20 13:41:38 +01:00
example_timer_complex_test.go fix spelling typo 2017-08-28 08:57:51 +08:00
example_timer_gauge_test.go Fix invalid Timer (gauge) example 2017-02-28 11:13:17 -04:00
example_timer_test.go Change the Timer API 2016-11-18 20:32:18 +01:00
examples_test.go Remove all deprecated features 2019-06-11 16:28:47 +02:00
expvar_collector.go Create a public registry interface and separate out HTTP exposition 2016-08-02 18:46:22 +02:00
expvar_collector_test.go Simplify if expr in ExampleNewExpvarCollector() 2018-04-13 23:23:52 +02:00
fnv.go Add missing license headers 2018-08-22 13:53:56 +02:00
gauge.go Add exemplars to counter and histogram 2020-01-24 17:12:08 +01:00
gauge_test.go Iterate on a proposed performance improvement for counters 2018-01-19 19:06:43 +01:00
go_collector.go Improve doc string for `go_gc_duration_seconds` 2020-01-06 13:38:35 +01:00
go_collector_test.go Unflake TestGoCollectorGoroutines 2019-10-14 19:44:28 +02:00
histogram.go Pull out ...WithExemplar methods into separate interfaces 2020-01-27 15:41:13 +01:00
histogram_test.go Pull out ...WithExemplar methods into separate interfaces 2020-01-27 15:41:13 +01:00
labels.go Update code based on the PR feedback 2018-11-02 09:01:14 -07:00
metric.go Use a cleaner initialization of `separatorByteSlice` 2019-10-15 19:52:31 +02:00
metric_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
observer.go Pull out ...WithExemplar methods into separate interfaces 2020-01-27 15:41:13 +01:00
process_collector.go Update doc comment of NewProcessCollector 2019-06-14 12:33:52 +02:00
process_collector_other.go Implement process collector for Windows (#596) 2019-06-14 12:26:55 +02:00
process_collector_test.go Rework process collector 2018-09-07 12:09:26 +02:00
process_collector_windows.go Implement process collector for Windows (#596) 2019-06-14 12:26:55 +02:00
process_collector_windows_test.go Implement process collector for Windows (#596) 2019-06-14 12:26:55 +02:00
registry.go ensure same collectorID calculated on reg and unreg 2019-10-17 14:16:32 +02:00
registry_test.go ensure same collectorID calculated on reg and unreg 2019-10-17 14:16:32 +02:00
summary.go Simplify code 2019-10-16 12:18:16 +02:00
summary_test.go Remove all deprecated features 2019-06-11 16:28:47 +02:00
timer.go Return observed duration from Timer.ObserveDuration 2018-12-03 21:10:34 +01:00
timer_test.go new handler instrumentation (#285) 2017-04-24 15:13:19 -04:00
untyped.go Remove the deprecated uses of Untyped metrics 2017-08-29 17:31:45 +02:00
value.go Remove obsolete references to `Untyped` from doc comments 2020-02-13 22:03:05 +01:00
value_test.go Add missing license headers 2018-08-22 13:53:56 +02:00
vec.go Explicitly forward metricVec methods Collect, Describe, Reset 2020-02-13 20:22:37 +01:00
vec_test.go Allow currying of metric vec's 2017-12-22 15:56:11 +01:00
wrap.go Make the AlreadyRegisteredError useful for wrapped registries 2019-06-14 17:55:35 +02:00
wrap_test.go fix: fix a typo 2019-05-01 17:50:23 +08:00

README.md

See go-doc.