Commit Graph

582 Commits

Author SHA1 Message Date
Björn Rabenstein 70f54973fb Merge pull request #75 from prometheus/beorn7/timestamp
Reduce allocations during fingerprinting.
2015-02-12 20:02:02 +01:00
Björn Rabenstein 3d6b23ae05 Merge pull request #76 from prometheus/histogram
Add support for histograms to parsers, extraction and creation.
2015-02-12 19:33:48 +01:00
Brian Brazil 6f2f8f28e8 Add support for histograms to parsers, extraction and creation.
This does not include a histogram metric usable from the go client.

See https://docs.google.com/document/d/1uSenXRDjDaJLV3qnSD09GqgPdEEDPjER0mVsnGaCYF0/edit#
2015-02-12 18:29:26 +00:00
beorn7 a9bdd32c71 Reduce allocations during fingerprinting.
Also, add a test to expose
https://github.com/prometheus/client_golang/issues/74 .

benchmark           old ns/op     new ns/op     delta
BenchmarkMetric     7034          6272          -10.83%

benchmark           old allocs     new allocs     delta
BenchmarkMetric     52             32             -38.46%

benchmark           old bytes     new bytes     delta
BenchmarkMetric     1976          1800          -8.91%
2015-02-12 15:28:31 +01:00
Tobias Schmidt 3d127c266e Merge pull request #73 from ddysher/fix-doc
Fix document
2015-02-11 17:44:59 -05:00
Deyuan Deng 550b950411 Fix document 2015-02-11 17:35:04 -05:00
Tobias Schmidt acbd2d3eac Merge pull request #70 from prometheus/handle-process-collector-errors-gracefully
Handle process collector errors gracefully
2015-02-11 15:08:24 -05:00
Tobias Schmidt 98061eecab Add todo comment to bring back error reporting 2015-02-11 14:58:35 -05:00
Björn Rabenstein 6760c3aacd Merge pull request #71 from prometheus/beorn7/timestamp
Remove obsolete comment and add Earliest and Latest timestamp.
2015-02-11 17:44:10 +01:00
beorn7 7d560564f9 Remove obsolete comment and add Earliest and Latest timestamp.
The latter is to eradicate the various MaxInt64 and MinInt64 in the
codebase.
2015-02-11 17:34:59 +01:00
Tobias Schmidt 7faf9e76ef Handle process collector errors gracefully
As it is expected that the process collector can fail under certain
conditions (proc information for a process only readable by root or
other user for example) and as there is currently no option to configure
the error behavior of the client, this change reverts the error
reporting introduced in 159e96f. This effectively means that errors are
simply ignored and there won't be any samples for the process_* metrics
in case of an error.

Once a user can control how to behave in case of errors returned by
collectors, this change should probably be reverted.
2015-02-10 16:19:27 -05:00
Tobias Schmidt c70db11f1e Merge pull request #68 from prometheus/add-nocgo-flag
Add 'nocgo' tag to remove cgo dependency on build
2015-02-10 03:43:17 -05:00
Johannes 'fish' Ziemke 93d11c8e35 Remove procfs dependency unless cgo is enabled 2015-02-09 16:38:04 +01:00
juliusv 52186fc518 Merge pull request #67 from prometheus/arch-os-build-fixes
Fix Go download link for several archs and OSes.
2015-02-05 18:14:57 +01:00
Julius Volz ecf2329b22 Use HTTPS for Go download. 2015-02-05 18:14:34 +01:00
Julius Volz 2e52ab1271 Fix Go download link for several archs and OSes. 2015-02-05 18:14:34 +01:00
Tobias Schmidt 3823272e90 Merge pull request #65 from prometheus/procfs-build-tags
Remove dependency on procfs/cgo in non-procfs systems
2015-02-02 15:51:36 -05:00
Tobias Schmidt d1d9dee31b Remove dependency on procfs/cgo in non-procfs systems
The procfs package has a cgo dependency (necessary to calculate system
times). As procfs is not available under windows, darwin and supposely
all newer BSD systems, this change remove the procfs dependency on these
systems.
2015-02-02 15:40:04 -05:00
Tobias Schmidt 728064bb68 Merge pull request #66 from prometheus/process-collector-explicit-error-interface
Use clear error interface for process pidFn
2015-02-02 15:06:09 -05:00
Tobias Schmidt 3cb16a9503 Use clear error interface for process pidFn
If a given pidFn for a process collector can't determine the pid, this
had to be signaled with an invalid pid so far (pid <= 0). In order to
make the error interface clearer for users, this change introduces an
explicit error parameter.
2015-02-02 14:59:24 -05:00
Björn Rabenstein babc844741 Merge pull request #64 from prometheus/beorn7/performance
Improve Gauge and Counter performance.
2015-02-02 18:51:05 +01:00
beorn7 4f73a8b017 Improve Gauge and Counter performance.
This is accomplished by using the functions from the atomic packages
instead of a mutex.

benchmark                                      old ns/op     new ns/op     delta
BenchmarkGaugeNoLabels-2                       118           9.40          -92.03%
BenchmarkGaugeNoLabels                         117           9.38          -91.98%
BenchmarkGaugeNoLabels-4                       117           9.40          -91.97%
BenchmarkCounterNoLabels-2                     137           16.8          -87.74%
BenchmarkCounterNoLabels                       136           16.8          -87.65%
BenchmarkCounterNoLabels-4                     136           16.8          -87.65%
BenchmarkGaugeWithLabelValues-4                400           279           -30.25%
BenchmarkGaugeWithLabelValues-2                398           279           -29.90%
BenchmarkGaugeWithLabelValues                  400           283           -29.25%
BenchmarkCounterWithLabelValues-4              397           286           -27.96%
BenchmarkCounterWithLabelValues-2              396           286           -27.78%
BenchmarkCounterWithLabelValues                394           285           -27.66%
BenchmarkCounterWithPreparedMappedLabels       587           454           -22.66%
BenchmarkCounterWithPreparedMappedLabels-2     581           456           -21.51%
BenchmarkCounterWithPreparedMappedLabels-4     654           539           -17.58%
BenchmarkCounterWithMappedLabels-2             1441          1218          -15.48%
BenchmarkCounterWithMappedLabels               1099          963           -12.37%
BenchmarkCounterWithMappedLabels-4             1636          1501          -8.25%
2015-02-02 18:11:11 +01:00
Björn Rabenstein 88b6ea5852 Merge pull request #63 from prometheus/beorn7/versioning
Introduce versioning and clean up the headers.
2015-02-02 15:33:45 +01:00
Bjoern Rabenstein b0107f53ac Added CHANGELOG.md and VERSION. 2015-02-02 15:25:18 +01:00
Bjoern Rabenstein d7f8eb1083 Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
Björn Rabenstein aa1328d02c Merge pull request #62 from prometheus/fix-writepb-race
Fix race condition in writePB().
2015-01-31 23:52:10 +01:00
Julius Volz f3e101bd1c Fix race condition in writePB().
The RLock already needs to be acquired when reading r.dimHashesByName.

This fixes https://github.com/prometheus/client_golang/issues/61
2015-01-31 22:10:27 +01:00
Björn Rabenstein e192dfc497 Merge pull request #60 from prometheus/beorn7/fix-const-labels
Add const labels to counter.
2015-01-28 15:59:29 +01:00
Bjoern Rabenstein 3798bbca12 Add const labels to counter. 2015-01-28 15:47:48 +01:00
Björn Rabenstein 80ad13d35e Merge pull request #53 from prometheus/beorn7/benchmark
Add benchmarks to compare text and protobuf parsing.
2015-01-27 18:15:20 +01:00
Bjoern Rabenstein 4092aaec40 Fix typos. 2015-01-27 18:07:09 +01:00
Bjoern Rabenstein b2128904e2 Add BenchmarkProcessor002ParseOnly, to get at least a hint of the JSON speed. 2015-01-27 17:16:23 +01:00
Bjoern Rabenstein 849d859db4 Add benchmarks to compare text and protobuf parsing. 2015-01-27 16:27:04 +01:00
juliusv 283d371002 Merge pull request #51 from prometheus/sample-formatting
Better sample value string formatting.
2015-01-26 01:41:16 +01:00
juliusv 000337ccc0 Merge pull request #52 from brian-brazil/make-example
Make examples buildable from make
2015-01-26 01:30:49 +01:00
Brian Brazil 5a2ed875a6 Make examples buildable from make 2015-01-26 00:19:15 +00:00
Julius Volz 4a842c5da0 Better sample value string formatting.
This forces a float format without exponent that uses the minimum number
of digits necessary to display a given sample value.
2015-01-25 23:52:46 +01:00
juliusv 316b327693 Merge pull request #50 from prometheus/beorn7/license-cleanup
License cleanup
2015-01-22 17:11:32 +01:00
juliusv 3713bd7d97 Merge pull request #48 from prometheus/beorn7/fix-summary-dimensions
Beorn7/fix summary dimensions
2015-01-22 17:03:39 +01:00
Bjoern Rabenstein 3706852780 License cleanup 2015-01-22 16:13:15 +01:00
Björn Rabenstein d5fe8ed656 Merge pull request #49 from prometheus/beorn7/fix-summaries
Beorn7/fix summaries
2015-01-21 16:42:22 +01:00
Bjoern Rabenstein 31b6c1fe12 Make number notation consistent. 2015-01-21 15:24:34 +01:00
Bjoern Rabenstein 15c9ded5a3 Fix the summary decay by avoiding the Merge method.
This makes the Observe method of summaries more expensive. :-(
2015-01-21 13:44:43 +01:00
Bjoern Rabenstein 6b9530d72e Update vendoring of perks to newest (fixed) version.
Adjust the API and usage accordingly.
Make tests stricter.

Since the merging is still faulty, test are broken now.
The next commit will fix it by avoiding merging.
2015-01-20 18:27:10 +01:00
Bjoern Rabenstein 26e2417d3e Quick-fix the doc comment. 2015-01-13 17:26:38 +01:00
Bjoern Rabenstein 5c6a472617 Merge branch 'beorn7/allow-collect-errors' into beorn7/fix-summary-dimensions 2015-01-13 16:54:12 +01:00
Björn Rabenstein aa848f77db Merge pull request #45 from prometheus/beorn7/allow-collect-errors
Allow error reporting during metrics collection and simplify Register().
2015-01-13 16:53:16 +01:00
Bjoern Rabenstein dd4e57186a Improve doc comment for Describe. 2015-01-13 16:52:42 +01:00
Bjoern Rabenstein 05059724f8 Remove the partition of summaries by HTTP status code and method.
Summaries as implemented cannot be aggregated in a meaningful
way. Partitoning them by status code and method only made sense if we
were interested in the individual latency and size of e.g. GET request
that result in status 503. In general, that's not the case. Most of
the time, the user will be interested in the latency and size of _all_
HTTP requests.

(With future changes to client_golang, we will consider making the
HTTP instrumentation configurable, e.g. to handle the case where the
user is only interested in the latency of successful requests.)
2015-01-13 14:57:37 +01:00
Bjoern Rabenstein 159e96f6c7 Allow error reporting during metrics collection and simplify Register().
Both are interface changes I want to get in before public
announcement. They only break rare usage cases, and are always easy to
fix, but still we want to avoid breaking changes after a wider
announcement of the project.

The change of Register() simply removes the return of the Collector,
which nobody was using in practice. It was just bloating the call
syntax. Note that this is different from RegisterOrGet(), which is
used at various occasions where you want to register something that
might or might not be registered already, but if it is, you want the
previously registered Collector back (because that's the relevant
one).

WRT error reporting: I first tried the obvious way of letting the
Collector methods Describe() and Collect() return error. However, I
had to conclude that that bloated _many_ calls and their handling in
very obnoxious ways. On the other hand, the case where you actually
want to report errors during registration or collection is very
rare. Hence, this approach has the wrong trade-off. The approach taken
here might at first appear clunky but is in practice quite handy,
mostly because there is almost no change for the "normal" case of "no
special error handling", but also because it plays well with the way
descriptors and metrics are handled (via channels).

Explaining the approach in more detail:

- During registration / describe: Error handling was actually already
  in place (for invalid descriptors, which carry an error anyway). I
  only added a convenience function to create an invalid descriptor
  with a given error on purpose.

- Metrics are now treated in a similar way. The Write method returns
  an error now (the only change in interface). An "invalid metric" is
  provided that can be sent via the channel to signal that that metric
  could not be collected. It alse transports an error.

NON-GOALS OF THIS COMMIT:

This is NOT yet the major improvement of the whole registry part,
where we want a public Registry interface and plenty of modular
configurations (for error handling, various auto-metrics, http
instrumentation, testing, ...). However, we can do that whole thing
without breaking existing interfaces. For now (which is a significant
issue) any error during collection will either cause a 500 HTTP
response or a panic (depending on registry config). Later, we
definitely want to have a possibility to skip (and only report
somehow) non-collectible metrics instead of aborting the whole scrape.
2015-01-12 19:16:09 +01:00