Commit Graph

1280 Commits

Author SHA1 Message Date
Björn Rabenstein 4739e9cf8c
Merge pull request #726 from prometheus/beorn7/promhttp
Fix promhttp error handling
2020-03-13 23:05:57 +01:00
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
Björn Rabenstein 346356f42e
Merge pull request #719 from simonpasquier/enable-circleci
Add Circle CI configuration
2020-03-03 19:51:20 +01:00
Bartlomiej Plotka 5538bedeb6
Merge pull request #720 from prometheus/beorn7/release
Cut v1.5.0
2020-03-03 15:54:55 +00:00
beorn7 42eb2da614 Cut v1.5.0
Signed-off-by: beorn7 <beorn@grafana.com>
2020-03-03 16:48:32 +01:00
Björn Rabenstein 057bfe813a
Merge pull request #718 from gotjosh/support-metric-metadata-endpoint
API Client: Support new metadata endpoint in v1
2020-02-28 16:35:34 +01:00
Simon Pasquier 2725e8e59c Add Circle CI configuration
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-02-28 11:59:41 +01:00
gotjosh 2463b8e78d Address review feedback
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-28 09:49:39 +00:00
gotjosh 7810669cc3 Update api/prometheus/v1/api_test.go
Co-Authored-By: Tobias Guggenmos <tguggenm@redhat.com>
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-27 17:52:05 +00:00
gotjosh bd79fe1bf1 Update api/prometheus/v1/api_test.go
Co-Authored-By: Tobias Guggenmos <tguggenm@redhat.com>
Signed-off-by: gotjosh <josue@grafana.com>
2020-02-27 17:52:05 +00:00
gotjosh 7f509dc4f4 API Client: Support new metadata endpoint in v1
Introduces support for the new metadata endpoint from Prometheus. The new endpoint provides information independent of targets and collapses the unique combinations of HELP, TYPE and UNIT.

Fixes #705

Signed-off-by: gotjosh <josue@grafana.com>
2020-02-26 17:48:57 +00:00
Simon Pasquier 673e4a177a
Merge pull request #717 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2020-02-25 09:38:19 +01:00
prombot 3ddb45b9c4 makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2020-02-25 00:08:30 +00:00
Björn Rabenstein b25ce2693a
Merge pull request #713 from prometheus/beorn7/promauto
Add a "factory" to make promauto work for custom registries
2020-02-14 16:41:32 +01:00
beorn7 1c2884b807 Add NewUntypedFunc to promauto
This constructor was simply forgotten.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-13 22:08:18 +01:00
beorn7 92c1ac77e7 Add a "factory" to make promauto work for custom registries
Also, update the package documentation. The concerns about the global
registry aren't really valid anymore because promauto now also works
with custom registries.

The musings about the http.DefaultMux are more a digression and
shouldn't be in a doc comment.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-13 22:03:30 +01:00
beorn7 87f9434351 Remove obsolete references to `Untyped` from doc comments
Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-13 22:03:05 +01:00
Björn Rabenstein 110f6d4693
Merge pull request #714 from prometheus/beorn7/doc
Explicitly forward metricVec methods Collect, Describe, Reset
2020-02-13 21:01:19 +01:00
beorn7 aa6eadda9c Explicitly forward metricVec methods Collect, Describe, Reset
Interestingly, methods implicitly forwarded from embedded types are
detected by GoDoc if they are just one level deep. Embedded types in
the embedded type are not recognized. This commit therefore adds
explicit forwarding methods for Collect, Describe, and Reset.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-13 20:22:37 +01:00
Björn Rabenstein 913f67ef06
Merge pull request #711 from prometheus/beorn7/release
Cut v1.4.1
2020-02-07 02:03:49 +01:00
beorn7 c02b77cdfe Cut v1.4.1
Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-07 01:32:47 +01:00
Björn Rabenstein 6134a11473
Merge pull request #710 from shreyassrivatsan/ss/fix
Initialize now fn for counter
2020-02-06 12:19:59 +01:00
Shreyas Srivatsan bc9e50c39f Initialize now fn for counters
Signed-off-by: Shreyas Srivatsan <shreyas@chronosphere.io>
2020-02-05 22:25:47 -08:00
Björn Rabenstein 76dd6c5819
Merge pull request #707 from prometheus/beorn7/release
Cut v1.4.0
2020-01-27 19:08:03 +01:00
beorn7 1e641931c9 Cut v1.4.0
Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-27 17:20:08 +01:00
beorn7 5eb1c10f8e Update dependencies
Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-27 15:47:00 +01:00
beorn7 9903214237 Fix typo in doc comment
Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-27 15:46:39 +01:00
Björn Rabenstein e951d7bae9
Merge pull request #708 from prometheus/beorn7/exemplars
Pull out ...WithExemplar methods into separate interfaces
2020-01-27 15:44:48 +01:00
beorn7 f34b09877c Pull out ...WithExemplar methods into separate interfaces
This is, sadly, the only way to avoid a breaking change. The cost is
that anyone using exemplars has to perform a type assertion. This is,
however, a common pattern where interfaces turn out to need additional
methods in a stable library or only some implementations can provide
the additional methods (AKA "interface upgrade").

Needless to say that in v2 of this library, we'll do things in a more
straight forward way.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-27 15:41:13 +01:00
Björn Rabenstein ba7901740d
Merge pull request #706 from prometheus/beorn7/exemplars
Add exemplars to counter and histogram
2020-01-24 17:17:39 +01:00
beorn7 c32ffd121f Add tests for examplars
Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-24 17:12:36 +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
Björn Rabenstein 803ef2a759
Merge pull request #703 from prometheus/testutil-metric-count
Added `testutil.CollectAndCount`
2020-01-09 12:53:08 +01:00
Bartlomiej Plotka 9e9cc003f8 Added testutil.CollectAndCount
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2020-01-09 11:20:19 +00:00
Björn Rabenstein b68ba26e47
Merge pull request #702 from prometheus/beorn7/doc
Improve doc string for `go_gc_duration_seconds`
2020-01-08 15:19:54 +01:00
beorn7 2be4bb406e Improve doc string for `go_gc_duration_seconds`
Fixes #618.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-01-06 13:38:35 +01:00
Björn Rabenstein c42bebe5a5
Merge pull request #700 from prometheus/beorn7/release
Update dependencies and cut v1.3.0
2019-12-20 21:53:46 +01:00
beorn7 339a70f084 Cut v1.3.0
Signed-off-by: beorn7 <beorn@grafana.com>
2019-12-20 20:43:45 +01:00
beorn7 780f6ab482 Update dependencies
Signed-off-by: beorn7 <beorn@grafana.com>
2019-12-20 20:43:37 +01:00
Björn Rabenstein e7776d2c54
Merge pull request #699 from joe-elliott/http-client-warnings
Return Prometheus Warnings
2019-12-13 01:07:50 +01:00
Joe Elliott 88792b1169 Moved warnings into apiclient
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-11 10:04:00 -05:00
Joe Elliott bd858421cd Fixed TestDoGetFallback test
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-11 09:36:49 -05:00
Joe Elliott 393adc9261 Refactor ~worked. All tests passing except one
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-10 16:53:38 -05:00
Joe Elliott 7f4279992e First pass unravel
Signed-off-by: Joe Elliott <number101010@gmail.com>
2019-12-10 15:16:44 -05:00
Björn Rabenstein 99d85f4901
Merge pull request #697 from prometheus/beorn7/doc
Improve doc comment for NewGaugeFunc
2019-12-10 11:42:33 +01:00
beorn7 de74638693 Improve doc comment for NewGaugeFunc
- Simplify confusing wording about concurrency safety.
- Add link to example for info metric.

Signed-off-by: beorn7 <beorn@grafana.com>
2019-12-09 18:20:27 +01:00
Björn Rabenstein 0da4c3a935
Merge pull request #695 from cben/api-client-examples-shadowing
api client examples: avoid shadowing package with variable
2019-12-09 14:56:54 +01:00
Beni Cherniavsky-Paskin 38c67520a3 api client examples: avoid shadowing package with variable
Signed-off-by: Beni Cherniavsky-Paskin <cben@redhat.com>
2019-12-09 14:55:16 +02:00
beorn7 9097a2cf2f Fix typo
Signed-off-by: beorn7 <beorn@grafana.com>
2019-12-04 21:11:33 +01:00
Björn Rabenstein f65e1535fb
Merge pull request #686 from Dean-Coakley/patch-2
Fix link to writing exporters guide
2019-11-28 16:09:12 +01:00