Commit Graph

725 Commits

Author SHA1 Message Date
Björn Rabenstein 74cfc2394a
Merge pull request #452 from prometheus/beorn7/testing2
Create an internal package
2018-09-03 00:31:06 +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
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
beorn7 fc4994c93c Remove removeUnusedWhitespace
It wasn't needed, as is now proven by the tests

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-08-22 23:54:26 +02:00
beorn7 545fe31ad6 Merge branch 'testutils' of git://github.com/brancz/client_golang into beorn7/testing 2018-08-22 23:48:23 +02:00
Björn Rabenstein ebce7d0078
Merge pull request #444 from glefloch/license
Add missing license headers
2018-08-22 19:59:59 +02:00
glefloch 61943b1eff Remove Makefile
Signed-off-by: glefloch <glfloch@gmail.com>
2018-08-22 16:53:48 +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 0d7f5cb39b Add check license in CI
Signed-off-by: glefloch <glfloch@gmail.com>
2018-08-22 14:35:50 +02:00
glefloch cb71127117 Add missing license headers
Signed-off-by: glefloch <glfloch@gmail.com>
2018-08-22 13:53:56 +02:00
Björn Rabenstein 29e6500a95
Merge pull request #443 from prometheus/beorn7/timestamp
Add a wrapper to add a timestamp to a metric
2018-08-21 15:54:28 +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
Frederic Branczyk 5b23715fac
Merge pull request #440 from simonpasquier/fix-vm-metric-name
Update the name of the maximum VM metric
2018-08-08 10:05:07 +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
Björn Rabenstein 0d7f07276c
Merge pull request #439 from lidalei/master
go routine to goroutine
2018-08-07 21:35:41 +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
Björn Rabenstein 472be16acf
Merge pull request #427 from edaniels/patch-1
Make delegators wrapping responseWriterDelegator have value receivers
2018-07-13 22:05:57 +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
Eric Daniels b3076e068e
Make delegators wrapping responseWriterDelegator have value receivers
Signed-off-by: Eric Daniels <eric@erdaniels.com>
2018-07-12 11:37:51 -04:00
Björn Rabenstein ee1c9d7e23
Merge pull request #424 from pedrosland/test
Move both examples into single Dockerfile for Docker Hub (fixes #347)
2018-07-11 00:10:52 +02:00
Peter Sutherland e9d57b3892 Move both examples into single Dockerfile for Docker Hub (fixes #347)
Signed-off-by: Peter Sutherland <peter@pedrosland.co.uk>
2018-07-09 19:09:06 +01:00
Björn Rabenstein ae27198cdd
Merge pull request #425 from prometheus/beorn7/registry
Introduce unchecked Collectors
2018-07-09 14:58:04 +02:00
beorn7 ad1b9f7754 Introduce unchecked Collectors
Fixes #47 . See there for more detailed discussion.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-07-09 14:33:18 +02:00
Frederic Branczyk 5d3b089f0c
Add testutils package
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2018-07-03 13:25:00 +02:00
Krasi Georgiev d6a9817c4a
Merge pull request #420 from alileza/update-dialer
Update DefaultRoundTripper to DialContext because Dial is deprecated
2018-06-29 06:51:34 +01:00
alileza bc3c7b9dd1 Update DefaultRoundTripper to DialContext because Dial is deprecated
Signed-off-by: alileza <alirezayahya@gmail.com>
2018-06-27 12:02:52 +02:00
Björn Rabenstein 77e8f2ddcf
Merge pull request #419 from neeral/invalid-prefix
Do not sanitize prefix in Graphite bridge
2018-06-23 17:59:54 +02:00
neeral fe6c0fa342 Do not sanitize prefix in Graphite bridge
Refer to #418.

Signed-off-by: neeral <neeral@users.noreply.github.com>
2018-06-22 13:00:54 -07:00
Björn Rabenstein faf4ec335f
Merge pull request #417 from prometheus/beorn7/registry
Relax consistency checks during gathering
2018-06-07 14:36:07 +02:00
beorn7 f6b1978ed4 Use stricter wording for Gather returning a non-nil error
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-06-07 14:35:06 +02:00
beorn7 c06fb788be Relax consistency checks during gathering
Also, clarify in the doc comment.

Previously, the assumption was that inconsistent label dimensions are
violating the exposition format spec. However, especially with the
knowledge that OpenMetrics will explicitly allow inconsistent label
dimensions in expositions, we should allow it in client_golang, too.

Note that registration with proper Descs provided will still check for
consistont label dimensions. However, you can "cheat" with custom
Collectors as you can collect metrics that don't follew the provided
Desc (this will be made more explicit and less cheaty once #47 is
fixed). You can also create expositions with inconsistent label
dimensions by merging Gatherers with the Gatherers slice type. (The
latter is used in the Pushgateway.)

Effectively, normal direct instrumentation will always have consistent
label dimensions in this way, but you can cover special use cases with
custom collectors or merging of different Gatherers.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-06-06 19:30:53 +02:00
Björn Rabenstein 208fa994be
Merge pull request #416 from prometheus/beorn7/doc
Make Krasi the maintainer for the HTTP API client
2018-06-06 14:56:43 +02:00
beorn7 d9d7508645 Make Krasi the maintainer for the HTTP API client
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-06-06 13:14:29 +02:00
Björn Rabenstein 7540c07074
Merge pull request #414 from bboreham/decode-400s
Decode JSON body when Prometheus returns 400 to an api call
2018-06-04 15:00:09 +02:00
Bryan Boreham 04c0326535 Add non-nil Data because Go 1.7 needs it
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2018-06-04 10:35:16 +00:00
Bryan Boreham 8fbbc9bc6b Decode JSON body when Prometheus returns 400 to an api call
400 and 422 are documented error codes from Prometheus, so we should
attempt to parse the error returned for both of them.

Needed to change a test that was requiring the old behaviour - made it
use 500 instead of 400.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2018-06-04 10:35:16 +00:00
Björn Rabenstein a62824bd1b
Merge pull request #415 from bboreham/mention-dco
Mention the DCO in the contributing guide
2018-06-02 02:32:45 +02:00
Bryan Boreham 3efa5ec66c Mention the DCO in the contributing guide
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2018-05-31 14:22:30 +00:00
Björn Rabenstein 42bc0a18c2
Merge pull request #413 from prometheus/beorn7/registry
Be more robust about nil pointers in protobuf
2018-05-29 19:01:24 +02:00