Commit Graph

63 Commits

Author SHA1 Message Date
Aliaksandr Valialkin
e7f78fa63c Switch from log-linear histograms to log-based histograms
Log-based histograms provide lower estimation error for the same number of buckets compared to log-linear histograms.

For example, the current Histogram implementation splits each decimal range (10^n .. 10^(n+1)] into 18 buckets.
These buckets have the following bounds:

- for log-linear histogram: (1 .. 1.5], (1.5 .. 2], (2 .. 2.5], ... (9.5 .. 10]
- for log-based histogram: (1 .. 1.136], (1.136 .. 1.292], ... (8.799 ... 10]

The maximum estimated error for log-linear histogram is reached in the first bucket per each decimal range and equals to 1.5-1=0.5 or 50%.
The maximum estimated error for log-based histogram is constant across buckets and equals to 1.136-1=0.136 or 13.6%.

This means that log-based histogram improves histogram accuracy by up to 50%/13.6% = 3.6 times when using the same number of buckets.

Further reading - https://linuxczar.net/blog/2020/08/13/histogram-error/
2021-02-15 14:26:03 +02:00
Aliaksandr Valialkin
43691b65a0 Read /proc/* file contents with ioutil.ReadFile() instead of opening it with os.Open() and scanning with bufio.Scanner
This simplifies the code a bit.
2021-02-08 14:23:40 +02:00
Aliaksandr Valialkin
c070763356 follow-up for 2a12f948a9 2021-02-04 16:28:55 +02:00
Nikolay
2a12f948a9
adds file descriptors metrics, (#19)
* adds file descriptors metrics,
for linux based systems,
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1037

* small fix
2021-02-04 16:10:10 +02:00
Roman Khavronenko
be819551e3
summary: fix Unregister behaviour for summary metric type (#16)
The change covers two things:
1. Cleanup of Set.a metrics list from per-quantile metrics
for summary.
2. Register summary metric and per-quantile metrics in one take.
This prevents registry corruption when Unregister called in the
middle of metric register process.
2020-08-07 12:59:44 +03:00
Roman Khavronenko
dd0c59c0d6
Remove timeseries with quantile labels when Unregister is called for summary #14 (#15) 2020-07-28 21:58:28 +03:00
Roman Khavronenko
6a144d3619
Add function to unregister metrics from default set #12 (#13) 2020-07-27 22:05:14 +03:00
Aliaksandr Valialkin
5edf5eaace vendor: update github.com/valyala/histogram from v1.1.1 to v1.1.2 2020-07-20 16:54:34 +03:00
Aliaksandr Valialkin
7ec95de8e8 vendor: update github.com/valyala/histogram from v1.0.1 to v1.1.1
This should reduce memory usage when big number of Summary metrics are in use
while small number of these metrics are updated
2020-07-20 16:50:58 +03:00
Aliaksandr Valialkin
fd1ac75aa0 gauge.go: mention FloatCounter in Gauge docs
Updates https://github.com/VictoriaMetrics/metrics/issues/11
2020-07-05 17:49:52 +03:00
Aliaksandr Valialkin
d81dd5ec9c Increase value precision in histograms from 5e-3 to 1e-12
Previously values could go into lower bucket because of too coarse precision.

Updates https://github.com/VictoriaMetrics/metrics/issues/8
2020-05-20 02:49:55 +03:00
Aliaksandr Valialkin
f6ff0f32a2 fix data race when accessing h.sum during histogram marshaling 2020-03-13 12:36:02 +02:00
Artem Navoiev
93f7956e2a
bump version of codecov-action to v1.0.6 2020-03-05 23:26:04 +02:00
Aliaksandr Valialkin
a494df3462 Properly unregister Summary metric in Set.UnregisterMetric 2020-02-26 20:37:47 +02:00
Roland Lammel
900c892625
Allow unregistration of metrics (#6)
* Allow unregistration of metrics

* Provide metrics.WritePrometheusSet to write using a dedicated metric set

* Cleanup unregister metrics patch, add generic WriteProcessMetrics
2020-02-26 19:52:38 +02:00
Aliaksandr Valialkin
0ee6a1fa32 Update url to MetricsQL in docs to Histogram 2020-02-10 23:05:09 +02:00
Ivan G
e6d6f46b5d Proposal: Add new type of counter: FloatCounter (#5)
* Add new type of counter: FloatCounter
* sometimes you need to count things with more precision than uint64
* FloatCounter also usefull if you need setable Gauge w/o callback func

* Fix PR review:
* sync.RWMutex -> sync.Mutex
* more idiomatic add/sub
2020-01-23 12:48:00 +02:00
Aliaksandr Valialkin
21c3ffd10e histogram.go: rename Extended PromQL to PromQL extensions to be more clear 2019-12-12 19:24:01 +02:00
Aliaksandr Valialkin
fcb89496ec Prevent from possible deadlock in Set.WritePrometheus when Gague callback could call Set.mu.Lock 2019-12-02 22:26:56 +02:00
Aliaksandr Valialkin
ddbf13fd17 histogram.go: add a link to https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL in Histogram docs 2019-11-27 14:06:17 +02:00
Aliaksandr Valialkin
4d9d3a095f Add examples for Histogram 2019-11-27 14:04:12 +02:00
Aliaksandr Valialkin
007e78a6c7 Add links to https://medium.com/@valyala/improving-histogram-usability-for-prometheus-and-grafana-bc7e5df0e350 from Histogram docs 2019-11-27 14:01:15 +02:00
Aliaksandr Valialkin
674ca26d5f Reduced the number of steps per decimal exponent from 5 to 2, since 5 is too big for the majority of cases 2019-11-25 15:19:31 +02:00
Aliaksandr Valialkin
3306660b50 Reduce histogram buckets from 0.1 to 0.02 of the size for the current decimal exponent
Also increase upper bound for histogram range from 10^12 to 10^18
2019-11-25 13:08:44 +02:00
Aliaksandr Valialkin
eb780f4caa Buffer all the output in memory before writing it to the provided io.Writer in WritePrometheus
This should prevent from indefinite locking of internal structures in the case of laggy io.Writer
2019-11-25 13:01:26 +02:00
Aliaksandr Valialkin
839018719c Add Histogram.VisitNonZeroBuckets 2019-11-23 23:58:18 +02:00
Aliaksandr Valialkin
eab0e32ed4 Added docs about Histogram 2019-11-23 13:04:24 +02:00
Aliaksandr Valialkin
83922c2aa8 Modify _vmbucket suffix to _bucket suffix for histogram buckets in order to be compatible with Prometheus histograms 2019-11-23 11:47:06 +02:00
Aliaksandr Valialkin
577f3b5e99 Remove rounding error when marshaling histogram ranges 2019-11-23 00:46:51 +02:00
Aliaksandr Valialkin
984b12dbb5 Add easy-to-use histograms 2019-11-23 00:16:38 +02:00
Aleksandr Razumov
42ee365914 all: fix typo lables -> labels (#3)
Thanks!
2019-09-30 00:06:17 +03:00
Artem Navoiev
cc02f82ddd [ci] update actions workflow. Run main flow when PR comes from fork 2019-09-11 09:35:50 +03:00
Artem Navoiev
a063987ba4 [ci] use github actions 2019-09-08 14:53:45 +03:00
Aliaksandr Valialkin
b9f1652800 Marshal integer *_sum metric for Summary without scientific notation 2019-08-13 13:24:46 +03:00
Aliaksandr Valialkin
c68df4bc3d Expose process_cpu_seconds_system_total and process_cpu_seconds_user_total in process metrics 2019-08-05 19:16:20 +03:00
Aliaksandr Valialkin
5a9cdd0bef Add process_* metrics similar to the metrics exposed by https://github.com/prometheus/client_golang
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/92
2019-07-12 17:18:57 +03:00
Aliaksandr Valialkin
2c308dd067 Properly handle metric names with lables when printing *_count and *_sum values for Summary 2019-06-28 14:14:47 +03:00
Aliaksandr Valialkin
9ee7f68256 go.mod: remove go1.13 line, so it will compile on go1.12 and go1.11 2019-06-28 14:02:13 +03:00
Aliaksandr Valialkin
d8a137bf94 Add <summary>_sum and <summary>_count values for Summary
This improves output compatibility with Prometheus Summary type
defined at https://prometheus.io/docs/concepts/metric_types/#summary
2019-06-28 13:58:41 +03:00
Aliaksandr Valialkin
6fc4c03c79 Update Summary quantiles before writing them to the output.
Previously Summary quantiles were updated after writing them to the output,
so the output contained old quantile values.
2019-06-28 11:13:39 +03:00
Aliaksandr Valialkin
2280bf270b README.md: mention the ability to export distinct metric sets via distinct endpoints 2019-06-01 23:26:53 +03:00
Aliaksandr Valialkin
0b2328476c typo fixes in ExampleSet 2019-06-01 23:24:25 +03:00
Aliaksandr Valialkin
ebce157dde Add Set for controlling metric sets to be exported via WritePrometheus call 2019-06-01 23:18:41 +03:00
Aliaksandr Valialkin
487af0fbfc Add a reference to VictoriaMetrics in package docs 2019-04-21 02:56:28 +03:00
Aliaksandr Valialkin
fb18155057 metrics.go: remove unused startTime 2019-04-17 14:43:23 +03:00
Aliaksandr Valialkin
6cd90960e1 Added GetOrCreateGauge to be consistent with Counter and Summary 2019-04-15 15:34:02 +03:00
Aliaksandr Valialkin
d8d17da673 Point to a Counter, which could be used as a gauge 2019-04-15 15:22:58 +03:00
Aliaksandr Valialkin
7c4a402be3 README.md: point to an example for CounterVec alternative 2019-04-11 17:28:52 +03:00
Aliaksandr Valialkin
bded4324a5 Added examples 2019-04-11 17:26:20 +03:00
Aliaksandr Valialkin
4ea76dd6b8 typo fix 2019-04-11 14:04:01 +03:00