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
beorn7
9542e4005c
Expose #512
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-06 11:22:30 +01:00
beorn7
48d3ae798b
Return observed duration from Timer.ObserveDuration
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-12-03 21:10:34 +01:00
beorn7
8d9c21f0cf
Nitpicking a doc comment
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-20 13:41:38 +01:00
Björn Rabenstein
f6443e74d4
Merge pull request #495 from SvenDowideit/add-extra-hints-to-clustermanager-example
...
Add the last few lines needed to show a new user how the Collector/Gatherer fits together
2018-11-20 13:35:42 +01:00
Dowideit, Sven (O&A, St. Lucia)
8324e65597
Add the last few lines needed to show a new user how the Collector/Gatherer fits together
...
Signed-off-by: Dowideit, Sven (O&A, St. Lucia) <Sven.Dowideit@csiro.au>
2018-11-20 15:46:27 +10:00
Peter Jausovec
a199184c14
Update the label is not valid error message to include the fqName
...
Fixes #504 .
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-11-19 16:51:57 -08:00
beorn7
8c67c139e2
Remove accidental gogo/protobuf import
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-16 13:23:08 +01:00
beorn7
c4c1f3461e
Fix tiny punctuation issue in doc comment
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-15 18:40:33 +01:00
PhilipGough
f9739b3d97
Compare text strings directly in testutil
...
Signed-off-by: PhilipGough <philip.p.gough@gmail.com>
2018-11-15 16:03:57 +00:00
PhilipGough
30503fe98e
Exposes bug #498 - unexpected results for Histograms in testutil
...
Signed-off-by: PhilipGough <philip.p.gough@gmail.com>
2018-11-14 11:58:43 +00:00
beorn7
86702ea6b4
Fix metric comparison for empty labels
...
reflect.DeepEqual is not suitable for zero occurrences of repeated
proto messages. This changes the comparison to act on the string
representation of proto messages.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-13 16:25:02 +01:00
beorn7
1db43792db
Expose bug #494
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-11-13 15:48:48 +01:00
Björn Rabenstein
da11cf2c83
Merge pull request #488 from peterj/master
...
Add more info to the inconsistent cardinality errors
2018-11-02 19:52:54 +01:00
Sevag Hanssian
88f4223778
Fix permissions of tempfile
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-11-02 09:59:03 -07:00
Peter Jausovec
f1bec54758
Update the ExampleRegister test
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-11-02 09:46:03 -07:00
Sevag Hanssian
924d5919f3
Improve WriteToTextfile doc
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-11-02 09:31:41 -07:00
Peter Jausovec
b686a9e02e
Remove fmt from import
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-11-02 09:21:12 -07:00
Peter Jausovec
ea348d7c20
Update code based on the PR feedback
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-11-02 09:01:14 -07:00
Sevag Hanssian
42e6616334
Use code that already existed
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-11-02 08:37:26 -07:00
Sevag Hanssian
1d54dabd43
Add WriteToTextfile test
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-10-31 23:34:50 -07:00
Sevag Hanssian
c5bdd15ac3
Remove typo
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-10-31 15:31:42 -07:00
Sevag Hanssian
e6fe89ce22
Add support for histograms and summaries
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-10-31 15:27:11 -07:00
Sevag Hanssian
9416ff209b
First commit - WriteToTextfile
...
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
2018-10-31 14:22:11 -07:00
Peter Jausovec
ceb819208d
copy/pasta error
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-10-31 11:16:16 -07:00
Peter Jausovec
4fe949f2fd
Add missing fmt import
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-10-31 11:09:12 -07:00
Peter Jausovec
902733d080
Add more info to the inconsistent cardinality errors
...
Signed-off-by: Peter Jausovec <peter.jausovec@oracle.com>
2018-10-31 11:01:42 -07:00
beorn7
fb0f7fe8c2
Pull up HTTP changes into deprecated functions
...
So that also users of those can benefit. Obviously, we will end
updating deprecated functions one day (at latest once v0.10 is out).
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-22 12:36:33 +02:00
beorn7
62361fc0fb
Use streaming encoding of metrics
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-22 01:04:52 +02:00
beorn7
752f50d366
Merge branch 'use-gzip-pool' of github.com:glefloch/client_golang into beorn7/http
2018-10-20 00:51:31 +02:00
glefloch
c2c6fd2ab4
Fix PR comments
...
Signed-off-by: glefloch <glfloch@gmail.com>
2018-10-19 13:51:45 +02:00
glefloch
fdf4cbc87b
Use sync.Pool for gzipWriter
...
Signed-off-by: glefloch <glfloch@gmail.com>
2018-10-17 13:17:33 +02:00
beorn7
5e8ac3cd58
Add a concurrent end-to-end test for observe-register-gather
...
This is an attempt to expose
https://github.com/istio/istio/issues/8906 . The failure to do so
makes me believe the error is either already fixed in current
client_golang, or something weird I haven't spotted yet is happening
in the istio code.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-10 16:59:24 +02:00
beorn7
e1fb14a776
Adjust TestRegisterWithOrGet to the present
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-10 15:41:21 +02:00
beorn7
edb489a1ef
Add check for duplicated label names
...
Fixes #471
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-30 16:25:48 +02:00
beorn7
dd9e125455
Expose failure to detect duplicate label names
...
This is #471 .
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-30 16:25:48 +02:00
beorn7
ff0177896a
Be more precise about concurrency requirements
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-29 10:47:28 +02:00
beorn7
7eb5e8a08a
Drain the desc channel after registering
...
This avoids leaking goroutines.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-29 10:44:19 +02:00
David E Worth
c2c648fdcb
fix exponential buckets failure message
...
it appears there is a copy/paste error in the exponential buckets test failure message which is fixed here.
Signed-off-by: David Worth <dworth@strava.com>
2018-09-25 17:42:06 -06:00
beorn7
7973e4709d
Ensure 64bit alignment on 32bit platforms for histograms
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-24 13:28:13 +02:00
beorn7
3a6edf5ff8
Handle items newly deprecated in Go 1.11
...
Remove where possible and ignore staticcheck warnings where we have
to.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-19 13:30:14 +02:00
beorn7
663a9ad019
Make Help strings optional
...
This is in line with
https://prometheus.io/docs/instrumenting/writing_clientlibs/#metric-description-and-help
Since the zero value of a string in Go is `""`, we cannot distinguish
between a Help string not set and an empty Help string. Thus, we just
make it formally optional here with an encouragement to set it in the
doc comment.
In v0.10, the Help string will probably become a "normal" argument of
the constructor rather than a field in an Opts struct.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-17 12:07:31 +02:00
beorn7
713e6eb604
Let NewConst... functions detect invalid Desc
...
The error of the invalid Desc is returned in that case.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-17 11:50:42 +02:00
beorn7
b7b390014b
Reformat doc comment of InstrumentHandler
...
To help linters detect the Deprecated message.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-14 13:24:05 +02:00
beorn7
cec67c9ec8
Improve deprecated doc comment
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-14 12:48:16 +02:00
Björn Rabenstein
1362cad3aa
Merge pull request #458 from prometheus/beorn7/registry
...
Wrappable registerers
2018-09-14 12:15:22 +02:00
beorn7
fe28f32433
Discourage prefixing every metris with WrapRegistererWithPrefix
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-14 11:59:13 +02:00
beorn7
cf9b2a8c78
Rename WrapWith... to WrapRegistererWith...
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-13 17:43:05 +02:00
beorn7
837c7cb1f4
Update Collector example
...
It now uses the new WrapWith function instead of ConstLabels. Describe
is now implemented via DescribeByCollect.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-12 15:34:13 +02:00
beorn7
84d7aa0cd9
Add wrapping of Registerers with labels and prefix
...
Essentially middleware for Registerers!
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-12 15:34:07 +02:00
beorn7
1b2bd1d665
Make Histogram observations atomic while keeping them lock-free
...
Fixes #275
This is rather tricky and required some studying of the Go memory
model. I have added copious code comments to explain what's going on.
Benchmarks haven't changed significantly, despite the additional
atomic operations now required during Observe. Write performance is
noticable, but it is also much more involved now and has a mutex. (But
note that Write is supposed to be a relatively rare operation and thus
not in the hot path compared to Observe.) Allocs haven't changed at
all.
OLD:
BenchmarkHistogramWithLabelValues-4 10000000 151 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramNoLabels-4 50000000 36.0 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve1-4 50000000 28.1 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve2-4 10000000 160 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve4-4 5000000 378 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve8-4 2000000 768 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramWrite1-4 1000000 1589 ns/op 896 B/op 37 allocs/op
BenchmarkHistogramWrite2-4 500000 2973 ns/op 1792 B/op 74 allocs/op
BenchmarkHistogramWrite4-4 300000 6979 ns/op 3584 B/op 148 allocs/op
BenchmarkHistogramWrite8-4 100000 10701 ns/op 7168 B/op 296 allocs/op
NEW:
BenchmarkHistogramWithLabelValues-4 10000000 191 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramNoLabels-4 30000000 50.1 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve1-4 30000000 40.0 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve2-4 20000000 91.5 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve4-4 5000000 317 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramObserve8-4 2000000 636 ns/op 0 B/op 0 allocs/op
BenchmarkHistogramWrite1-4 1000000 2072 ns/op 896 B/op 37 allocs/op
BenchmarkHistogramWrite2-4 300000 3729 ns/op 1792 B/op 74 allocs/op
BenchmarkHistogramWrite4-4 200000 7847 ns/op 3584 B/op 148 allocs/op
BenchmarkHistogramWrite8-4 100000 16975 ns/op 7168 B/op 296 allocs/op
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-12 15:03:44 +02:00
beorn7
1e08f788cf
Add test to expose #275
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-07 19:04:00 +02:00
beorn7
773f502723
Rework process collector
...
This unifies both constructors in one with an options argument.
The options argument allows to switch on error reporting, as discussed
in #219 .
The change of the contructor signature is breaking, but only mildly
so. Plus, the process collector is rarely used explicitly. I used
Sourcegraph to search for public usages, with the following results:
- 2 occurrences of NewProcessCollectorPIDFn, once in @discordianfish's
glimpse, once in @fabxc's etcd_exporter (deprecated anyway). Both
are Prom veterans and will simply do the one line change if needed.
- 8 occurrences of NewProcessCollector, of which 7 are of the form
NewProcessCollector(os.Getpid(), "")
Thus, it's a very easy change, which I even hinted at in the doc
comment.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-07 12:09:26 +02:00
beorn7
6803bb4021
Add a DescribeByCollect helper
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-05 14:10:51 +02:00
beorn7
74a2f46d2c
Add package documentation
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-04 14:02:20 +02:00
beorn7
1301cf8fcd
Add helper function to extract a simple float value from a metric
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
foo
2018-09-04 14:02:19 +02:00
beorn7
da330f4281
Un-export prometheus.LabelPairSorter
...
The only known external usage of it was in prometheus/pushgateway,
where it was removed by
https://github.com/prometheus/pushgateway/pull/200 .
Originally, the expectation was that users would implement the Metric
interface now and then. As we know now, neither it is happening, nor
would it make a lot of sense. (Users implement the Collector interface
instead.) By now, LabelPairSorter is essentially noise in the already
quite cluttered namespace in the prometheus package.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-03 16:20:55 +02:00
Björn Rabenstein
a10423e9da
Merge pull request #445 from prometheus/beorn7/testing
...
Add testutil package
2018-09-03 00:31:34 +02:00
beorn7
7be86f93c1
Create an internal package
...
This is for types we don't want to export but which are used in
different packages within client_golang.
Currently, that's only NormalizeMetricFamilies (used in the prometheus
package and in the testutil package). More to be added as needed.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-03 00:18:11 +02:00
beorn7
5ba0993f6f
Improved interface
...
- Expected text format is now read from an io.Reader.
- Metrics are gathered from a Gatherer.
- Added a convenience wrapper to collect from a Collector.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-02 21:07:38 +02:00
Yutian Li
94f32c433e
typo
...
Signed-off-by: Yutian Li <hotpxless@gmail.com>
2018-08-27 12:01:30 -04:00
beorn7
154f28a316
Fix import grouping
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-23 00:05:02 +02:00
beorn7
e60f998e9b
Make license headers consistent
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-22 23:59:40 +02:00
beorn7
df0210c26c
Rename testutils to testutil and move below prometheus dir
...
`testutil` is more in line with stdlib naming conventions.
The package should be below `prometheus` as it only provides utils to
test exposition code, not to test HTTP client code.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-22 23:57:08 +02:00
glefloch
949c45bad2
Add missing header and fix review comments
...
Signed-off-by: glefloch <glfloch@gmail.com>
2018-08-22 15:32:42 +02:00
glefloch
cb71127117
Add missing license headers
...
Signed-off-by: glefloch <glfloch@gmail.com>
2018-08-22 13:53:56 +02:00
beorn7
abaece07d1
Fix import grouping
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-18 16:02:33 +02:00
beorn7
5240f7e8f5
Add a wrapper to add a timestamp to a metric
...
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-18 15:56:08 +02:00
Simon Pasquier
d6dbfbfc28
Update the name of the maximum VM metric
...
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-08-08 08:09:48 +02:00
Björn Rabenstein
420e2efa8f
Merge pull request #438 from simonpasquier/add-max-vsize-process-metric
...
Add process_maximum_virtual_memory_bytes metric
2018-08-07 21:38:51 +02:00
Dalei Li
927ca8e4f4
go routine to goroutine
...
Signed-off-by: Dalei Li <dalei.li@icloud.com>
2018-08-07 21:23:58 +02:00
Simon Pasquier
4ab15af0dc
Add process_maximum_virtual_memory_bytes metric
...
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-08-07 17:10:30 +02:00
Björn Rabenstein
bcbbc08eb2
Merge pull request #429 from prometheus/beorn7/summary
...
Add more checks around summaries and histograms
2018-07-13 22:10:52 +02:00
beorn7
4572e24546
Add suffix collision checks during gathering
...
So far, if a gauge was named `xxx_count`, and a summary or histogram
`xxx`, this would have led to a legal protobuf exposition but would
have created a name collision on `xxx_count` in the text format and
within the Prometheus server.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-07-13 16:29:17 +02:00
Eric Daniels
2d0312e3dd
forgot some &s
...
Signed-off-by: Eric Daniels <eric@erdaniels.com>
2018-07-13 09:28:19 -04:00
beorn7
767a0218df
Add more label checksn during gathering
...
Including check for an invalid "quantile" label in summaries.
Also, improve error messages.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-07-13 14:14:39 +02:00
beorn7
e064aa97f1
Check quantile label during SummaryVec construction
...
Also, document the existing behavior more clearly.
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-07-13 13:43:21 +02:00
Eric Daniels
c02aadb406
remove references to delegators
...
Signed-off-by: Eric Daniels <eric@erdaniels.com>
2018-07-12 17:56:44 -04:00