Commit Graph

25 Commits

Author SHA1 Message Date
Aliaksandr Valialkin
7a44715774
histogram.go: code cleanup after e40cfe3ab5
The Histogram.Merge() function is needed for https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6314

Updates https://github.com/VictoriaMetrics/metrics/pull/73
2024-07-16 12:56:09 +02:00
AndrewChubatiuk
925f863c7b
fixed histogram merge 2024-07-09 11:04:36 +03:00
AndrewChubatiuk
5e5f209f79
histograms: fixed panic in merge when target bucket is nil 2024-05-20 15:46:52 +03:00
AndrewChubatiuk
e40cfe3ab5
added function for histograms merge 2024-05-19 11:06:13 +03:00
Artem Navoiev
1efad2cf86
change link to metricsql in histogram.go
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2024-03-18 12:24:50 +01:00
Roman Khavronenko
9dc7358869
allow exposing meta information for registered metrics (#61)
* allow exposing meta information for registered metrics

New public method `ExposeMetadata` allows enabling exposition
of dummy meta-info for all exposed metrics across all Sets.

This feature is needed to improve compatibility
with 3rd-party scrapers that require meta information to be present.

This commit doesn't update exposition of default system/process
metrics to keep the list of changes small. This change should
be added in a follow-up commit.

https://github.com/VictoriaMetrics/metrics/issues/48

* cleanup

* wip

* wip

* wip

* wip

---------

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-12-19 02:36:54 +02: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