Commit Graph

407 Commits

Author SHA1 Message Date
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 3d1d93eb51 Remove use of deprecated procfs functions
Signed-off-by: beorn7 <beorn@grafana.com>
2019-06-04 19:26:20 +02:00
Björn Rabenstein 388f9869ac
Merge pull request #588 from prometheus/beorn7/test
Attempt to fix flakiness of TestGoCollectorMemStats
2019-05-26 23:20:33 +02:00
beorn7 c818d96e15 Unflake TestGoCollectorGC
It is perfectly possible that a normal GC happens just before the
forced one. Thus seeing 2 GCs is fine.

Whenever this test failed, it was because two GCs were seen.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-26 14:11:51 +02:00
beorn7 fe90eea9bb Attempt to fix flakiness of TestGoCollectorMemStats
This is really lame as it essentially just uses longer times to
wait. The test is still timing-dependent and thus could still
theoretically fail with unlucky scheduling. However, we are testing
something that _is_ about timing. Turning this all into something not
timing-dependent would be first quite involved and second might defeat
the purpose of testing code that is inherently about timing.

Let's see how this works out in practice.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-26 13:25:59 +02:00
beorn7 b5f69192ee Purge remaining references to v0.10 from doc comments
Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-16 23:35:36 +02:00
beorn7 bc54582c5e Make use of pre-existing context in InstrumentRoundTripperTrace
Fixes #580

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-16 17:52:19 +02:00
beorn7 6c520f6aca Add test to expose #580
Tests are heavily inspired by @shturec, see #584.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-16 17:52:19 +02:00
Björn Rabenstein 775f94f6fc
Merge pull request #581 from prometheus/beorn7/test
Fix race in TestGoCollectorMemStats
2019-05-16 15:31:37 +02:00
beorn7 e91cd81632 Remove outdated use-case description from doc comment
We stopped advertising binary-wide setting of a label quite a while
ago. This doc comment was missed in the cleanup.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-16 11:23:48 +02:00
beorn7 709dc4b1de Fix race in TestGoCollectorMemStats
Related to #573 (but only partially fixes it).

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-16 10:37:37 +02:00
Camilo Viecco facfcc21f8 fix regression issue 574
Signed-off-by: Camilo Viecco <camilo_viecco1@symantec.com>
2019-05-14 11:44:55 -07:00
beorn7 886e2ee0c0 Clarify deprecation of `DefObjectives`
Previously, the whole `Objectives` field was marked as deprecated by
linters.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-08 13:38:43 +02:00
Björn Rabenstein 2d3b0fe0e0
Merge pull request #568 from prometheus/beorn7/go-collector
Return previous memstats if Go collector needs longer than 1s
2019-05-07 00:10:32 +02:00
Bjoern Rabenstein 7cf0955421 Handle long ReadMemStats duration in Go collector
tl;dr: Return previous memstats if reading new ones takes longer than
1s.

See the doc comment of NewGoCollector for details.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-06 23:28:31 +02:00
beorn7 547c945a62 Replace fmt.Sprintf by simple concatenation
In this simple case, it's the fastest and easiest.

Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-06 23:28:31 +02:00
beorn7 016273b1f9 Fix and tweak Go collector tests
Signed-off-by: beorn7 <bjoern@rabenste.in>
2019-05-06 23:28:31 +02:00
Björn Rabenstein f1d50bcc55
Merge pull request #559 from nghialt/master
Add HTTPClient interface to Pusher struct
2019-05-06 01:31:30 +02:00
NghiaLT 6ea6f07918 Replace HTTPClient with HTTPDoer; Update document accordingly
Signed-off-by: NghiaLT <nghialt.11@gmail.com>
2019-05-06 04:28:14 +07:00
Björn Rabenstein 906d2976cb
Merge pull request #567 from prometheus/beorn7/counter
Make TestCounterAddLarge more robust
2019-05-04 18:08:04 +02:00
Bjoern Rabenstein bf1f4e4a24 Make TestCounterAddLarge more robust
The previous `float64(math.MaxUint64 + 1)` is too close to
`float64(math.MaxUint64)` to actually overflow as indended.

The counter code is actually converting forward and backward and
compare the original and twice-converted value. On most platform, this
will create a deviation and thus trigger the expected behavior. By
sheer "luck", one might end up with the same value and thus still use
the uint64 representation. Which is OK within the precision we can
expect. But it breaks the test. With this change, the next
representable floating point value greater than the floating point
value used to represent math.MaxUint64 is used.

Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-05-03 22:25:32 +02:00
Bjoern Rabenstein 57f7bd35fd Remove remaining traces of pre-go-1.8 handling
Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-05-03 21:30:30 +02:00
KevinBetterQ a325fb7566 fix: fix a typo
Signed-off-by: KevinBetterQ <1093850932@qq.com>
2019-05-01 17:50:23 +08:00
Bjoern Rabenstein 1173d73405 Increase minimum required Go version to 1.9
This allows us to simplify a bunch of code while still supporting the
last four Go minor versions.

We have also run into minor annoyances a couple of times by now to
keep supporting 1.7 and 1.8.

It's time to pull the plug!

Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in>
2019-04-28 23:28:57 +02:00
NghiaLT c9d77912ac Add HTTPClient interface to Pusher struct
Signed-off-by: NghiaLT <nghialt.11@gmail.com>
2019-04-26 16:53:21 +07:00
Simon Pasquier 6894bb3c7c Add .golangci.yml
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-25 10:38:07 +02:00
Simon Pasquier 15da21f1e4 *: replace golang.org/x/net/context by context
The context package is available since Go 1.7 which is the minimal version
supported by client_golang.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-09 15:10:51 +02:00
Sergiusz Urbaniak 60728f445d prometheus/promhttp: actually observe values in trace in example
This is similar to
https://github.com/prometheus/client_golang/pull/535 fixing ExampleInstrumentRoundTripperDuration.

Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
2019-03-06 13:59:53 +01:00
Frank Spitulski 10e34c668f fix(push): incorporate changes from review
Signed-off-by: Frank Spitulski <fspituls@ucsd.edu>
2019-02-24 15:15:35 -08:00
Frank Spitulski 7b127b3fe5 feat(push): add format builder option
Allow users to specify which format the pusher should push in.

Signed-off-by: Frank Spitulski <fspituls@ucsd.edu>
2019-02-24 12:51:45 -08:00
beorn7 4c99dd6630 Port histogram improvements into noObjectivesSummary
Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-11 19:10:17 +01:00
beorn7 295f7e4861 Fix some comment and naming nits as leftover from #536
Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-11 18:52:52 +01:00
Pascal S. de Kloe 19ff277483 Save memory on histograms: slightly faster with less code (#536)
Use the highest bit for buffer switch tracking in histograms

Signed-off-by: Pascal S. de Kloe <pascal@quies.net>
2019-02-11 18:29:02 +01:00
kklipsch a11607d7ae fix client trace examples to actually capture metrics
Signed-off-by: kklipsch <kklipsch@example.com>
2019-02-04 20:30:19 +00:00
beorn7 8785922956 Revert "Fix tests to adhere to the recent change in prometheus/common"
This reverts commit 2c9811f88e.

This is necessary because the changes in prometheus/common got reverted.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-01-27 23:18:44 +01:00
Matt Layher da7d5640a2 prometheus: reword comment to avoid cursing
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-01-16 17:03:06 -05:00
beorn7 b3d6096432 Improve testutil error messages
This also satisfy newer staticcheck versions.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-01-06 00:22:03 +01:00
beorn7 91b385db44 Fix staticcheck errors in push_test.go
Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-01-05 22:11:07 +01:00
Björn Rabenstein 2945395678
Merge pull request #525 from RomanKrasavtsev/patch-1
fix typo
2019-01-05 21:35:34 +01:00
Björn Rabenstein cf7da0f496
Merge pull request #521 from prometheus/beorn7/summary
Lock-free summaries without objectives
2019-01-05 21:23:43 +01:00
Roman Krasavtsev c51ed6941c fix typo
Signed-off-by: Roman Krasavtsev <mr.krasavtsev@gmail.com>
2019-01-04 21:14:10 +01:00
JoeWrightss fb3d5cb2ad Fix some spelling errors (#523)
* Fix some spelling errors

Signed-off-by: JoeWrightss <zhoulin.xie@daocloud.io>
2018-12-30 21:31:21 +01:00
gkze ee4e5e071e Fix typo again
Signed-off-by: gkze <george.kontridze@gmail.com>
2018-12-26 17:39:47 -08:00
beorn7 226b83ac2e Provide lock-free implementation for Summary without objectives
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-24 11:23:13 +01:00
beorn7 a006a7550a Remove unused constants and fields
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-24 11:22:57 +01:00
gkze 67bb2a7be3 Fix typo
Signed-off-by: gkze <george.kontridze@gmail.com>
2018-12-21 15:40:57 -08:00
beorn7 2c9811f88e Fix tests to adhere to the recent change in prometheus/common
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-18 17:20:25 +01:00
beorn7 000ceb266b Fix doc comment typo
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-18 16:30:34 +01:00
beorn7 619eb595ba Simplify an `append` to `copy`
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-06 11:37:34 +01:00
beorn7 fae889635c Fix #512
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-06 11:35:30 +01:00