Commit Graph

1299 Commits

Author SHA1 Message Date
beorn7 39dbb24d13 Add helper functions for linting to testutil
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-24 23:44:59 +02:00
beorn7 6433bcf819 Add the capability to lint MetricFamilies directly
Also, change all the `dto.MetricFamily` arguments to pointers to be
more consistent with what we do in client_golang in general.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-24 23:42:49 +02:00
Simon Pasquier 35355f03a2 Remove Travis CI
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-04-24 17:22:20 +02:00
Björn Rabenstein a3a59237d1
Merge pull request #739 from RainbowMango/pr_porting_promlint
Porting promlint from prometheus/prometheus
2020-04-24 16:06:34 +02:00
Björn Rabenstein a200f1930c
Merge pull request #738 from colega/colega/gauge-func-const-labels-godoc
GaugeFunc: ConstLabels godoc example
2020-04-24 14:29:25 +02:00
Oleg Zaytsev 38045061c3
GaugeFunc: ConstLabels godoc example
Document the example usage of ConstLabels to register several GaugeFuncs
on the same metric name. Also reference it from the NewCounterFunc
documentation as it's similar.

Ref: https://github.com/prometheus/client_golang/pull/736

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2020-04-24 09:33:20 +02:00
RainbowMango 50cda505d1 fix static check warnings by Goland.
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-04-24 10:15:27 +08:00
Björn Rabenstein fe756993ed
Merge pull request #741 from prometheus/beorn7/go-requirement
Add Go 1.14
2020-04-23 18:16:16 +02:00
beorn7 7bbc897b25 Add Go 1.14
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-23 18:08:53 +02:00
Björn Rabenstein 4e3a96e781
Merge pull request #740 from RainbowMango/pr_fix_unit_test_failing_with_go1.14
Fix unit test failing with Go1.14+
2020-04-23 16:53:41 +02:00
RainbowMango af6ade7230 Fix unit test failing with Go1.14+
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-04-23 15:14:34 +08:00
RainbowMango 3c5e60edc1 Porting promlint from prometheus/prometheus.
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-04-23 14:09:29 +08:00
Björn Rabenstein efb148ca4d
Merge pull request #734 from cobolbaby/master
fix: process_resident_memory_bytes detected is incorrect in Win7 32bit
2020-04-13 13:43:00 +02:00
cobolbaby c6babafd27 feat: Change processMemoryCounters struct uint declaration to uintptr
Signed-off-by: cobolbaby <cobolbaby@qq.com>
2020-04-13 10:44:09 +08:00
cobolbaby 0bb7f92c09 fix: process_resident_memory_bytes detected is incorrect in Win7 32bit
Ref: https://github.com/prometheus/client_golang/issues/728
Signed-off-by: Cobolbaby <Zhang.Xing-Long@inventec.com>
2020-04-10 16:38:16 +08:00
Björn Rabenstein 70a94c09a1
Merge pull request #731 from huanggze/master
Improve API error handling
2020-04-03 16:23:26 +02:00
huanggze 8f87c69651
Improve API error handling
Signed-off-by: huanggze <loganhuang@yunify.com>
2020-04-02 16:02:06 +08:00
Bartlomiej Plotka aa9238db67
Merge pull request #727 from prometheus/beorn7/release
Cut v1.5.1
2020-03-14 11:57:06 +00:00
beorn7 bb96a66cf6 Cut v1.5.1
Signed-off-by: beorn7 <beorn@grafana.com>
2020-03-13 23:10:05 +01:00
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