Commit Graph

694 Commits

Author SHA1 Message Date
Adam Thomason 660e6909cc promauto: add NewCounterFunc and NewGaugeFunc 2018-03-17 14:01:36 -07:00
Björn Rabenstein c3324c1198
Merge pull request #386 from var23rav/master
Replaced hardcoded arg('GET') with http.MethodGet constant
2018-02-23 15:47:18 +01:00
Vaisakh Rajagopal e06fadcc6f Replaced hardcoded arg('GET') with http.MethodGet constant 2018-02-23 00:53:19 +05:30
Björn Rabenstein e69720d204
Merge pull request #385 from prometheus/beorn7/auto
Add a package promauto that provides auto-registering metrics
2018-02-16 14:12:53 +01:00
beorn7 b82bcfe55f Add a package promauto that provides auto-registering metrics
Finally, I found an easy solution to provide the "evil"
auto-registration without getting death threats from the wardens of Go
purity. The reasoning can be found in the package's doc comment.
2018-02-16 12:55:57 +01:00
Björn Rabenstein fcc130e101
Merge pull request #384 from prometheus/godoc
Add Godoc link at the top of the README
2018-02-15 13:11:06 +01:00
Brian Brazil a331f1ea4a Add Godoc link at the top of the README
For those following that link, make it more obvious
which subpackage they probably want.
2018-02-15 11:45:41 +00:00
Björn Rabenstein 7e8a70d021
Merge pull request #381 from prometheus/beorn7/push
Add completely new push syntax
2018-02-14 19:20:02 +01:00
beorn7 361cb3a7d0 Delete another use of HostnameGrouping from a doc comment 2018-02-14 18:59:17 +01:00
beorn7 38de287a56 Remove obsolete copyright notices 2018-02-14 18:49:18 +01:00
beorn7 779cbe15b2 Remove HostnameGrouping method 2018-02-14 17:19:52 +01:00
Björn Rabenstein f265126b80
Merge pull request #383 from prometheus/brian-brazil-patch-2
Fix a typo
2018-02-14 15:58:15 +01:00
beorn7 3c2baee2d1 Add completely new push syntax
This allows adding more options in elegant ways, showcased here by
HTTP basic auth and by injecting a custom http.Client.

Fixes #341 and #372.
2018-02-14 13:40:57 +01:00
Brian Brazil 02aee00fdb
Fix a typo 2018-02-14 11:10:46 +00:00
Björn Rabenstein a40133b69f
Merge pull request #379 from prometheus/beorn7/http
promhttp: Introduce limit for connections in flight and timeout
2018-02-10 15:02:05 +01:00
beorn7 c551c3c661 promhttp: Introduce limit for connections in flight and timeout 2018-02-09 17:05:10 +01:00
beorn7 c332b6f63c Now really fix the coverage badge for API 2018-02-09 13:56:02 +01:00
beorn7 884767e914 Fix coverage badge and godoc link for API 2018-02-09 13:52:19 +01:00
beorn7 955ebdc0d9 Minor README.md fix 2018-02-09 13:48:56 +01:00
beorn7 3f8ab26c34 Add an issue template 2018-02-09 13:47:34 +01:00
beorn7 c5b094d7a6 Update README.md to explain the release situation
I will also update the issue template.
2018-02-09 13:41:14 +01:00
Björn Rabenstein a85074fc85
Merge pull request #377 from prometheus/beorn7/http
Provide an InstrumentedHandler
2018-02-08 17:52:34 +01:00
beorn7 8fd47d2e8f Provide an InstrumentedHandler
See https://github.com/prometheus/client_golang/issues/316 for details.
2018-02-08 16:27:51 +01:00
Björn Rabenstein 137706c199
Merge pull request #378 from prometheus/beorn7/doc
Document that the process collector only works on Linux
2018-02-08 15:03:59 +01:00
beorn7 154bb450e4 Document that the process collector only works on Linux 2018-02-08 14:17:54 +01:00
Björn Rabenstein 9bb6ab929d
Merge pull request #374 from prometheus/beorn7/http
Fix more interface upgrade bugs
2018-02-03 15:28:15 +01:00
beorn7 e87046a87e Fix more interface upgrade bugs 2018-02-02 15:53:28 +01:00
beorn7 d892fd2b51 Add test to expose interface upgrade bug
In principle, we needed to iterate through all permutations, mirroring
the same that is happening in the code. For lack of time, I only
picked one of the cases currently buggy.

As said, this really needs code generation, should we ever find
ourselves touching this again.
2018-02-02 15:50:46 +01:00
Björn Rabenstein ebe4271dac
Merge pull request #373 from tsandall/master
Fix delegator return value for single hijacker
2018-02-02 15:21:57 +01:00
Torin Sandall 44a8a1218c Fix delegator return value for single hijacker
Previously, the pickDelegator function was not returning a
*hijackerDelegator so the return value did not implement the Hijacker
interface. As a result, code that attempts to hijack the connection
would fail when using a type assertion.

All the other cases returned the hijackerDelegator correctly.
2018-02-01 10:57:42 -08:00
Björn Rabenstein f4fb1b73fb
Merge pull request #370 from prometheus/beorn7/performance
Create goroutines adaptively during metrics gathering
2018-01-31 15:28:26 +01:00
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