Commit Graph

293 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Adam Thomason 660e6909cc promauto: add NewCounterFunc and NewGaugeFunc 2018-03-17 14:01:36 -07: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
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
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
beorn7 c551c3c661 promhttp: Introduce limit for connections in flight and timeout 2018-02-09 17:05:10 +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
beorn7 154bb450e4 Document that the process collector only works on Linux 2018-02-08 14:17:54 +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
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