prometheus/cmd/promtool
Filip Petkovski 583f3e587c
Optimize histogram iterators (#13340)
Optimize histogram iterators

Histogram iterators allocate new objects in the AtHistogram and
AtFloatHistogram methods, which makes calculating rates over long
ranges expensive.

In #13215 we allowed an existing object to be reused
when converting an integer histogram to a float histogram. This commit follows
the same idea and allows injecting an existing object in the AtHistogram and
AtFloatHistogram methods. When the injected value is nil, iterators allocate
new histograms, otherwise they populate and return the injected object.

The commit also adds a CopyTo method to Histogram and FloatHistogram which
is used in the BufferedIterator to overwrite items in the ring instead of making
new copies.

Note that a specialized HPoint pool is needed for all of this to work 
(`matrixSelectorHPool`).

---------

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2024-01-23 17:02:14 +01:00
..
testdata promtool: allow setting multiple matchers to "promtool tsdb dump" command. (#13296) 2024-01-15 10:29:53 +00:00
analyze.go Add analyze histograms command to promtool (#12331) 2024-01-10 17:32:36 +01:00
analyze_test.go Add analyze histograms command to promtool (#12331) 2024-01-10 17:32:36 +01:00
archive.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
backfill.go enable gocritic, unconvert and unused linters 2023-04-13 19:20:22 +00:00
backfill_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
debug.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
main.go Enhanced visibility for promtool test rules with JSON colored formatting (#13342) 2024-01-18 09:49:16 -05:00
main_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
metrics.go Add a header to count retried remote write requests (#12729) 2023-09-20 11:11:03 +01:00
query.go Add analyze histograms command to promtool (#12331) 2024-01-10 17:32:36 +01:00
rules.go Merge branch 'main' into linter/nilerr 2023-04-19 19:56:39 +02:00
rules_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
sd.go SD Managers taking over responsibility for registration of debug metrics (#13375) 2024-01-23 16:53:55 +01:00
sd_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
tsdb.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
tsdb_test.go promtool: allow setting multiple matchers to "promtool tsdb dump" command. (#13296) 2024-01-15 10:29:53 +00:00
unittest.go Enhanced visibility for promtool test rules with JSON colored formatting (#13342) 2024-01-18 09:49:16 -05:00
unittest_test.go Enhanced visibility for promtool test rules with JSON colored formatting (#13342) 2024-01-18 09:49:16 -05:00