prometheus/cmd/promtool
Bryan Boreham 8b863c42dd
Optimise relabeling by re-using memory (#11147)
* model/relabel: Add benchmark

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* model/relabel: re-use Builder across relabels

Saves memory allocations.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* labels.Builder: allow re-use of result slice

This reduces memory allocations where the caller has a suitable slice available.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* model/relabel: re-use source values slice

To reduce memory allocations.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Unwind one change causing test failures

Restore original behaviour in PopulateLabels, where we must not overwrite the input set.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* relabel: simplify values optimisation

Use a stack-based array for up to 16 source labels, which will be the
vast majority of cases.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* lint

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-08-19 15:27:52 +05:30
..
testdata Fix promtool check config not erroring properly on failures (#10952) 2022-07-01 14:38:49 +02: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 refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
backfill_test.go cmd: use t.TempDir instead of ioutil.TempDir on tests (#9852) 2021-11-23 20:09:28 -05: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 no-default-scrape-port feature flag (#9523) 2022-07-20 13:35:47 +02:00
main_test.go Fix promtool check config not erroring properly on failures (#10952) 2022-07-01 14:38:49 +02:00
rules.go Optimise relabeling by re-using memory (#11147) 2022-08-19 15:27:52 +05:30
rules_test.go Update and fix interface (#11131) 2022-08-10 10:14:52 +02:00
sd.go no-default-scrape-port feature flag (#9523) 2022-07-20 13:35:47 +02:00
sd_test.go no-default-scrape-port feature flag (#9523) 2022-07-20 13:35:47 +02:00
tsdb.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
unittest.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
unittest_test.go Disable time based retention in tests (#8818) 2022-01-02 23:46:03 +01:00