Commit Graph

20 Commits

Author SHA1 Message Date
greyireland
60fb01a811 feature:compatible 2023-02-07 14:27:40 +08:00
Aliaksandr Valialkin
4ca082233a
all: go fmt from Go1.19 2022-08-08 17:15:06 +03:00
Aliaksandr Valialkin
98a1807528 Inline Histogram.resetLocked function 2021-03-16 12:14:36 +02:00
Aliaksandr Valialkin
cea3ca311b Reset histogram sum on Histogram.Reset call 2021-03-16 12:13:43 +02:00
Aliaksandr Valialkin
57c9db1bc3 properly handle Histogram.Update(1e-9)
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1096
2021-03-01 16:47:08 +02:00
Aliaksandr Valialkin
16e4558792 Move bucket index calculations to the place where they are used
This can help https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1096
2021-02-28 17:39:14 +02:00
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
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
Aliaksandr Valialkin
0ee6a1fa32 Update url to MetricsQL in docs to Histogram 2020-02-10 23:05:09 +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
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
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
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