Commit Graph

935 Commits

Author SHA1 Message Date
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
Marcin Owsiany f30f428035 Add a way to return the body of a 5xx response. (#484)
expose body when handling HTTP errors

Signed-off-by: Marcin Owsiany <marcin@owsiany.pl>
2018-10-25 18:44:21 +01:00
Björn Rabenstein 16f375c74d
Merge pull request #482 from prometheus/beorn7/http
Use gzip from a pool and stream while encoding metrics
2018-10-22 13:47:59 +02: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
Björn Rabenstein 1cafe34db7
Merge pull request #480 from prometheus/beorn7/release
Release v0.9.0
2018-10-15 16:52:39 +02:00
beorn7 b2c0ab4f6e Release v0.9.0
This ends a long time of not really tagging versions (as it didn't
make a lot of sense - we could have tagged every commit with a new
minor release essentially). I still worked through the git log and GH
issues to create a nice CHANGELOG.md.

As dependency management tools really love version tags these days, I
plan to tag more often from now on. The ideas behind the pre-1.0
version numbers are explained in the README.md as changed in this
commit.

I also changed the issue template accordingly.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-15 13:28:28 +02:00
beorn7 0b47a5c709 Move ISSUE_TEMPLATE into .github directory
Much less confusing...

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-14 23:36:14 +02:00
Björn Rabenstein 7866eead36
Merge pull request #478 from prometheus/beorn7/testing2
Add a concurrent end-to-end test for observe-register-gather
2018-10-10 18:13:31 +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
Björn Rabenstein e5d4a249c9 Adjust TestRegisterWithOrGet to the present (#477)
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-10 16:58:48 +02:00
Adam Jaso 93edea3720 Do not parse json on 204 responses (#476)
* Do not return BadResponse for no content 

Signed-off-by: Adam Jaso <2285656+adamjaso@users.noreply.github.com>
2018-10-10 17:20:17 +03:00
beorn7 e1fb14a776 Adjust TestRegisterWithOrGet to the present
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-10-10 15:41:21 +02:00
Björn Rabenstein 0a8115f42e
Merge pull request #474 from prometheus/beorn7/testing
Add check for duplicated label name
2018-10-01 19:40:01 +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
Björn Rabenstein daeaac0cfb
Merge pull request #472 from prometheus/beorn7/registry
Fix a few minor things...
2018-09-29 11:53:47 +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
Björn Rabenstein 2d5a6493f8
Merge pull request #467 from daveworth/patch-1
fix exponential buckets failure message
2018-09-26 16:21:55 +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
Björn Rabenstein f69c853d21
Merge pull request #466 from prometheus/beorn7/histogram
Ensure 64bit alignment on 32bit platforms for histograms
2018-09-24 13:34:49 +02: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
Björn Rabenstein 73edb9af66
Merge pull request #462 from prometheus/beorn7/testing
Add Go 1.11
2018-09-19 13:43:04 +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 2c6e80549e Add Go 1.11.
Since the staticcheck support for older Go versions will disappear,
update the exclusion regexp.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-19 12:24:24 +02:00
Björn Rabenstein e637cec7d9
Merge pull request #460 from prometheus/beorn7/desc
Detect invalid Descs in const metrics, but also allow empty Help strings.
2018-09-17 12:21:22 +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
Björn Rabenstein b5bfa0eb2c
Merge pull request #457 from prometheus/beorn7/histogram
Lock-free atomic observations in Histograms!
2018-09-12 15:04:00 +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
Björn Rabenstein 7858729281
Merge pull request #456 from prometheus/beorn7/process_collector
Rework process collector
2018-09-07 12:25:42 +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
Björn Rabenstein 3525612fea
Merge pull request #455 from prometheus/beorn7/desc
Add a DescribeByCollect helper
2018-09-05 14:55:05 +02:00
beorn7 6803bb4021 Add a DescribeByCollect helper
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-05 14:10:51 +02:00
Björn Rabenstein 2dbc3a58c2
Merge pull request #454 from prometheus/beorn7/testing
Add a single-value extractor and general package doc
2018-09-04 14:48: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