Commit Graph

1313 Commits

Author SHA1 Message Date
beorn7 4957f7bba4 Add a safety goroutine budget
This makes sure we don't spin up a possibly infinite number of
goroutines in `Gather`, which could theoretically happen with unlucky
scheduling.
2018-01-31 14:49:15 +01:00
beorn7 e04451f4be Create goroutines adaptively during metrics gathering 2018-01-26 19:58:07 +01:00
Björn Rabenstein 06bc6e01f4
Merge pull request #368 from smcquay/bench/counter
Add a benchmark for concurrent counter increments
2018-01-20 15:10:31 +01:00
Stephen McQuay (smcquay) b77ed204f6
Add a benchmark for concurrent counter increments 2018-01-19 15:15:10 -08:00
Björn Rabenstein b49b54cdb5
Merge pull request #367 from prometheus/beorn7/counter
Make Counter faster for simple Inc or Add with an integer
2018-01-19 19:46:57 +01:00
beorn7 a2facc3074 Iterate on a proposed performance improvement for counters
Original discussion see
https://github.com/prometheus/client_golang/pull/362 .

Assuming that the most frequently used method of a `Gauge` is `Set`
and the most frequently used method of a `Conuter` is `Inc`, this
separates the implementation of both metric types. `Inc` and integral
`Add` of a counter is now handled in a separate `uint64`. This would
create a race in `Set`, but luckily, there is no `Set` anymore in a
counter.

All attempts to solve above race (to use the same idea for a `Gauge`)
slow down `Set`, So we just stick with the old implementation
(formerly `value`) for `Gauge`.
2018-01-19 19:06:43 +01:00
beorn7 c7029dc87d Merge branch 'counter/fixed-prec' of git://github.com/smcquay/client_golang into beorn7/counter 2018-01-19 13:12:07 +01:00
beorn7 f02bfc3484 Minor doc comment fix
This was forgotten to be included in the previous commit.
2018-01-11 16:59:30 +01:00
Björn Rabenstein 180b8fdc22
Merge pull request #365 from prometheus/beorn7/vec
Allow currying of metric vec's
2017-12-24 17:04:06 +01:00
beorn7 9ac0bad606 Take into account curried labels in promhttp 2017-12-24 14:39:06 +01:00
beorn7 1ba60c7d58 Pull currying methods up into ObserverVec interface 2017-12-22 16:11:58 +01:00
beorn7 dd20712622 Allow currying of metric vec's
The idea behind it is described in detail in
https://github.com/prometheus/client_golang/issues/320 .

This commit also updates the example given in
promhttp/instrument_server_test.go , which nicely illustrates the
benefit of this change.

So far, currying could be emulated by creating different metric vec's
with different values in their ConstLabels. This was quite difficult
to grasp - which is essentially what was done in the example mentioned
above. Now that this use case can be solved without ConstLabels, we
can safely declare ConstLabels as rarely used. (Perhaps we can
deprecate them entirely one day, but I'll take a raincheck on that
when the changes of v0.10 have materialized.) This commit thus also
updates the ConstLabel doc comments in the various Opts. (It contained
fairly outdated stuff anyway.)
2017-12-22 15:56:11 +01:00
beorn7 10c55533cb Rename the receiver of `...Vec` methods from `m` to `v` 2017-12-21 14:06:39 +01:00
beorn7 9e1588b2a2 Pull `With` and `WithLabelValues` up into exported types
The "panic in case of error" code was so far in metricVec. This pulls
it up into the exported types like CounterVec. This is code
replication, but it avoids an explicit type conversion. Mostly,
however, this is preparation to make the wrapped metricVec an
interface (required for curried vec's).
2017-12-21 14:06:39 +01:00
Stephen McQuay (smcquay) 35559538c7
Implements review commentary
Specifically @beorn7 pointed out that the previous implementation had
some shortcomings around large numbers. I've changed the code to match
the suggestion in review, as well as added a few test cases.
2017-12-15 11:03:30 -08:00
Stephen McQuay (smcquay) ae6939214c
Adds a faster counter 2017-12-15 11:03:24 -08:00
Björn Rabenstein 661e31bf84
Merge pull request #361 from siddontang/siddontang/client-series
v1: support series API
2017-12-01 13:22:22 +01:00
siddontang 3c0e2b3c2e v1: support series API 2017-11-24 20:12:53 +08:00
Björn Rabenstein 1cdba8fdde
Merge pull request #360 from icholy/master
Omit zero value query time
2017-11-20 18:45:06 +01:00
Ilia Choly a132856ffd Omit zero value query time 2017-11-16 16:39:52 -05:00
Björn Rabenstein 5cec1d0429 Merge pull request #354 from prometheus/brian-brazil-patch-1
Fix typo in comment
2017-10-05 13:29:15 +02:00
Brian Brazil 9f5d03c01f Fix typo in comment 2017-10-04 17:44:49 +01:00
Björn Rabenstein 353b8c3f37 Merge pull request #348 from dlespiau/2017-09-11-examples-docker-images
Create Docker images for the examples
2017-09-21 12:55:43 +02:00
Damien Lespiau ec06aca188 Create Docker images for the examples
When those are published on Dockerhub, people will be able to start those
examples in fewer steps than the current documentation:

  https://prometheus.io/docs/introduction/getting_started/#starting-up-some-sample-targets

While relying on Docker may not be always wished, giving the possibility to
quickly start a daemon that exposes metrics can be useful in many tutorials.

The simple and random example are build as static binaries and packaged as
single binaries in Docker images.

This commit tries really hard to limit the number of per-example maintenance
work by sharing most of the Makefile to build the Docker images. The tiny top
level Makefiles in each example directory are strictly identical.

Updates: #347
2017-09-19 13:59:05 +01:00
beorn7 50b3332fd6 Polishing some doc comments 2017-09-13 12:48:29 +02:00
Björn Rabenstein 5032813742 Merge pull request #349 from povilasv/summary-doc
Change summary docs
2017-09-13 12:42:30 +02:00
Povilas Versockas 77a1417b06 Change summary docs 2017-09-12 20:27:18 +03:00
Björn Rabenstein 671c87b047 Merge pull request #346 from prometheus/beorn7/versioning
Drop Go1.6 support, add test for Go1.9
2017-09-07 17:06:25 +02:00
beorn7 36f4ab6bce Drop Go1.6 support, add test for Go1.9
Also, document the version requirement.
2017-09-06 15:36:30 +02:00
Björn Rabenstein 00e08dd66d Merge pull request #345 from mattbostock/correct_docs
Correct DefaultRegistry to DefaultRegisterer
2017-09-05 11:18:01 +02:00
Matt Bostock b092a4bc11 Correct DefaultRegistry to DefaultRegisterer
`DefaultRegistry` no longer exists as of a6321dd0b.
2017-09-05 01:08:40 +01:00
Björn Rabenstein 967789050b Merge pull request #343 from prometheus/beorn7/http
Fix error reporting bug
2017-08-31 15:19:02 +02:00
beorn7 2cb8df16e3 Fix error reporting bug
That's the same bug fixed in #342 (which is the deprecated code only
replicated in the `prometheus` package until v0.10 is out).
2017-08-31 15:10:58 +02:00
Brian Brazil 535f493f5a Merge pull request #342 from wrouesnel/master
http.go: incorrect error message displayed when no metrics encoded error
2017-08-31 09:39:07 +01:00
Will Rouesnel a166207919 http.go: incorrect error message displayed when no metrics encoded error
The "No metrics encoded" error was erroneously displayed the value of err, not
lastErr.
2017-08-31 12:05:46 +10:00
Björn Rabenstein 61d8c3f402 Merge pull request #340 from prometheus/beorn7/deprecation
Remove the deprecated uses of Untyped metrics
2017-08-29 17:37:40 +02:00
beorn7 6164fff8ce Remove the deprecated uses of Untyped metrics
I couldn't find any use of the removed identifiers on sourcegraph.com
(outside of this repo itself).
2017-08-29 17:31:45 +02:00
Brian Brazil 140d476395 Merge pull request #339 from linlynn/master
fix spelling typo
2017-08-28 08:26:11 +01:00
Lynn Lin be904beebc fix spelling typo 2017-08-28 08:57:51 +08:00
Björn Rabenstein 3eb912b336 Merge pull request #335 from marco-jantke/check-validity-of-label-values
Check validity of label values
2017-08-25 18:06:44 +02:00
Marco Jantke a956c5fdd6 improve validation function naming 2017-08-25 17:58:59 +02:00
Marco Jantke 0b8aef084e implement review feedback 2017-08-25 14:51:19 +02:00
Marco Jantke 6df742e132 improve formatting of invalid label value error messages 2017-08-20 00:54:11 +02:00
Marco Jantke 555018f3c9 make code compatible with go 1.6 2017-08-20 00:53:55 +02:00
Marco Jantke 685a3c90d4 fail Gather'ing when label value is not utf8 2017-08-20 00:10:32 +02:00
Marco Jantke 7ee20d77cb validate ConstLabels values in NewDesc 2017-08-20 00:09:51 +02:00
Marco Jantke 703c4a9c6f add label value validation to NewConstMetric and friends 2017-08-20 00:09:51 +02:00
Marco Jantke 459e88167e extract and refactor label validation functions
so that we can reuse them in other parts of the code, not only as part
of a metricVec.
2017-08-20 00:09:50 +02:00
Marco Jantke 957bba6f68 add label value validation to GetMetricWith and friends 2017-08-19 22:55:41 +02:00
Björn Rabenstein 94ff84a9a6 Merge pull request #329 from infoverload/add_new_metric_go_info
Add new default metric go_info
2017-07-24 10:13:13 +02:00