Commit Graph

742 Commits

Author SHA1 Message Date
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
beorn7 1b56b5c497 Be more robust about nil pointers in protobuf
While not strictly correct, it can easily happen that proto messages
are created that use nil pointers instead of pointers in empty strings
to denote an empty string.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-05-29 17:57:33 +02:00
Björn Rabenstein c51dc758d4
Merge pull request #409 from prometheus/beorn7/doc
Document the stop-the-world implications of the Go collector
2018-05-19 21:23:40 +02:00
beorn7 d66ac8f863 Document the stop-the-world implications of the Go collector
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-05-19 21:14:04 +02:00
Björn Rabenstein 46db556846
Merge pull request #408 from prometheus/bjk/go_test
Update travis Go versions
2018-05-18 16:32:30 +02:00
Ben Kochie adeda94c12
Update travis Go versions
* Add Go 1.10.x.
* Fix indenting.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-05-18 16:26:59 +02:00
Björn Rabenstein 82f5ff156b
Merge pull request #402 from bobmshannon/bs/extend_prom_api_interface
Implement AlertManager, Status, and Target methods
2018-04-17 01:38:56 +02:00
Björn Rabenstein f1323f902c
Merge pull request #404 from knweiss/fixes
Cleanups and fixes
2018-04-16 13:13:47 +02:00
Karsten Weiss d7590aab3c Fix three shadow variable warnings (govet -shadow)
Fixes:
http.go:118: declaration of "part" shadows declaration at http.go:117
http_test.go:50: declaration of "respBody" shadows declaration at http_test.go:25
promhttp/http.go:305: declaration of "part" shadows declaration at promhttp/http.go:304

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Karsten Weiss f3a13af35c http.go: Move helper function nowSeries() to test case
Fixes:
http.go:142:1⚠️ nowSeries is unused (deadcode)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Karsten Weiss 0a453dce84 Build process_collector_test.go only on Linux
The test case requires the /proc filesystem. The change prevents this skip
message during "go test -v" on platforms other than Linux:

=== RUN   TestProcessCollector
--- SKIP: TestProcessCollector (0.00s)
	process_collector_test.go:15: skipping TestProcessCollector, procfs not available: could not read /proc: stat /proc: no such file or directory

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Karsten Weiss 7a495a15b3 Type processCollector: Remove unused field 'pid'
Fixes:
process_collector.go:19:2: field pid is unused (U1000)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Karsten Weiss ea0d27e8cf Type responseWriterDelegator: Remove unused fields
Fixes:
http.go:355:2: field handler is unused (U1000)
http.go:355:11: field method is unused (U1000)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:25:14 +02:00
Karsten Weiss 958ea82988 Fix typos
Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:23:52 +02:00
Karsten Weiss 245fde70cb Simplify if expr in ExampleNewExpvarCollector()
Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:23:52 +02:00
Karsten Weiss 587d5265f8 metric.go: Remove unused type hashSorter
Fixes:
metric.go:130:6: type hashSorter is unused (U1000)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:23:52 +02:00
Karsten Weiss e01f7ec4fb Remove unnecessary conversion
Fixes:
go_collector.go:268:66⚠️ unnecessary conversion (unconvert)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:18:25 +02:00
Karsten Weiss 66b5a26cec Remove unnecessary for loop in makeLabelPairs()
Fixes:
value.go:155:2: should replace loop with labelPairs = append(labelPairs, desc.constLabelPairs...) (S1011)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:18:20 +02:00
Karsten Weiss daa9993ded Use direct API calls
Fixes:
prometheus/http_test.go:117:5⚠️ should use resp.Body.String() instead of string(resp.Body.Bytes()) (S1030) (megacheck)
prometheus/http_test.go:118:56⚠️ should use resp.Body.String() instead of string(resp.Body.Bytes()) (S1030) (megacheck)

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-13 23:17:58 +02:00
Bob Shannon 335dadb61a PR comments
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-12 06:49:52 -07:00
Bob Shannon e3e66d0bb9 PR comments
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-11 07:38:50 -07:00
Bob Shannon fc258df5b5 Fix deep equal comparison for time.Time
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 19:33:01 -07:00
Bob Shannon e035b26e30 Bump go version used in build
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 18:44:17 -07:00
Bob Shannon 5393573c73 Implement AlertManager, Status, and Target methods
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-10 07:21:46 -07:00
Björn Rabenstein e11c6ff817
Merge pull request #398 from bobmshannon/feature/admin_api
Add support for API admin methods
2018-04-10 15:01:17 +02:00
Bob Shannon 10dfec77bf Implement admin methods for Prometheus API
Signed-off-by: Bob Shannon <bshannon@palantir.com>
2018-04-09 21:03:46 -07:00
Björn Rabenstein 2f0e84125d
Merge pull request #401 from erock2112/master
Fix unprotected write in metricMap
2018-04-09 16:46:44 +02:00
Eric Boren ddd94f24c5 Fix unprotected write in metricMap 2018-04-09 10:10:15 -04:00
Luke Hanley f504d69aff promhttp: fix DNSDone should call Done, not Start (#395)
When tracing, it appears DNSDone is instead calling the supplied DNSStart function
2018-03-28 15:04:30 +02:00
Björn Rabenstein d49167c4b9
Merge pull request #394 from prometheus/beorn7/testing
Fix TestHandler
2018-03-19 14:17:21 +01:00
beorn7 d7f8852e05 Fix TestHandler
prometheus/common has changed and now adds the charset to the
Content-Type header.
2018-03-19 14:04:12 +01:00
Björn Rabenstein 07e5c3ca88
Merge pull request #393 from athomason/promauto-funcs
promauto: add NewCounterFunc and NewGaugeFunc
2018-03-19 13:43:13 +01:00
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