Commit Graph

1227 Commits

Author SHA1 Message Date
Tom Wilkie 9c8ba1f945 Review feedback: add comment and tests for WrapRegistererWith.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 11:51:51 +01:00
Tom Wilkie 614377c550 Review feedback: use one line.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:57:40 +01:00
Tom Wilkie 8961609f91 Ensure that nil registers are treat as a no-op, even when wrapping.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:30:51 +01:00
Björn Rabenstein 84c6b9db90
Merge pull request #762 from prometheus/beorn7/doc
Improve doc comments in promauto
2020-06-03 14:18:14 +02:00
beorn7 3ba240a80f Improve doc comments in promauto
In particular, point out that `With(nil)` is valid.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-06-03 13:56:49 +02:00
Björn Rabenstein 056e8af303
Merge pull request #755 from lilic/add-runtimeinfo
api/prometheus/v1/api.go: Add support for status/runtimeinfo endpoint
2020-06-03 13:17:52 +02:00
Björn Rabenstein 59508bb79c
Merge pull request #761 from prometheus/mdl-kelvin
testutil/promlint: allow Kelvin as a base unit for color temperature
2020-06-02 18:06:07 +02:00
Matt Layher 3afa5ab1e1
testutil/promlint: allow Kelvin as a base unit for color temperature
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-28 11:54:54 -04:00
Björn Rabenstein 3bb96180b6
Merge pull request #756 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2020-05-19 14:38:55 +02:00
Björn Rabenstein 150f9212ff
Merge pull request #757 from RainbowMango/pr_bump_golang_protobuf_14_2
Bump github.com/golang/protobuf to v1.4.2
2020-05-19 14:28:05 +02:00
RainbowMango 93cac27dd5 Bump github.com/golang/protobuf to v1.4.2
Signed-off-by: RainbowMango <renhongcai@huawei.com>
2020-05-19 11:40:21 +08:00
prombot 6090117ca1 makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2020-05-19 00:08:43 +00:00
Lili Cosic 6c43f2ebc2 api/prometheus/v1/api_test.go: Add test case for runtimeinfo endpoint
Signed-off-by: Lili Cosic <cosiclili@gmail.com>
2020-05-18 20:12:53 +02:00
Lili Cosic c9e3c020a9 api/prometheus/v1/api.go: Add support for /runtimeinfo endpoint
Signed-off-by: Lili Cosic <cosiclili@gmail.com>
2020-05-18 20:12:53 +02:00
Björn Rabenstein bff02dd561
Merge pull request #754 from prometheus/beorn7/deprecation
Add lint:ignore for protobuf deprecation
2020-05-18 15:31:02 +02:00
Björn Rabenstein d8b51d4981
Merge pull request #753 from prometheus/beorn7/test
Improve CollectAndCount
2020-05-15 13:19:43 +02:00
beorn7 dba1478b8a Add lint:ignore for protobuf deprecation
`github.com/golang/protobuf/proto` is deprecated in lieu of
`google.golang.org/protobuf/proto`. However, we cannot simply
migrate. Types from the proto package are exposed to users of packages
in this repo. If we migrate here, users have to migrate to. Thus, we
could only migrate with a major version bump.

In different news, with all the inline lint:ignore comments, including
the existing ones, there is no need to repeat the exception in the
Makefile.

A current version of `staticcheck` is happy with the code after this
commit. golangci-lint is broken at the moment, however, and ignores
the lint:ignore comments in the code as well as those via envvar.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-14 20:11:22 +02:00
Björn Rabenstein ef4f0376f5
Merge pull request #752 from prometheus/beorn7/push
Properly handle empty job and label values
2020-05-14 18:57:43 +02:00
beorn7 0577ef6c57 Improve CollectAndCount
Now that we have also added CollectAndLint and GatherAndLint, I
thought we should bring CollectAndCount in line. So:

- Add GatherAndCount.
- Add filtering by metric name.
- Add tests.

Minor wart: CollectAndCount should now return `(int, error)`, but that
would be a breaking change as the current version just returns
`int`. I decided to let the new version panic when it should return an
error. An error is anyway very unlikely, so the biggest annoyance here
is really just the inconsistency.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-14 00:17:45 +02:00
beorn7 389d3c3b9a Properly handle empty job and label values
An empty job name was always an error, but it was previously only
detected when pushing to the PGW and receiving an error. With this
commit, the error is detected before pushing.

An empty label value should have been OK but was encoded in a way that
couldn't be pushed to the
PGW. Cf. https://github.com/prometheus/pushgateway/issues/344 . This
commit changes the creation of the path in the URL so that it works
with empty label values.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-05-13 23:35:31 +02:00
Björn Rabenstein ce2dae2878
Merge pull request #745 from mcristina422/patch-1
Fix typo in godoc help text
2020-05-04 17:30:29 +02:00
Michael Cristina be019d1f24 Fix typo in godoc help text
Signed-off-by: Michael Cristina <mcristina444@gmail.com>
2020-05-02 10:44:25 -05:00
Björn Rabenstein 6edbbd9e56
Merge pull request #744 from prometheus/beorn7/release
Update dependencies and cut v1.6.0
2020-04-28 13:07:46 +02:00
beorn7 9c28cb92b4 Cut v1.6.0
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-28 13:06:56 +02:00
beorn7 332f3243f1 Update dependencies
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-27 18:18:59 +02:00
Björn Rabenstein 00d5f9eb03
Merge pull request #743 from prometheus/beorn7/test
Add linter helpers to testutil
2020-04-27 14:49:40 +02:00
beorn7 dc79bd6093 Improve various comments
Signed-off-by: beorn7 <beorn@grafana.com>
2020-04-25 15:59:53 +02:00
Björn Rabenstein 2f196c72a8
Merge pull request #742 from simonpasquier/remove-travis
Remove Travis CI
2020-04-25 00:41:08 +02:00
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