prometheus/rules
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
..
fixtures fixes yamllint errors 2021-06-12 12:47:47 +02:00
alerting.go Optimise relabeling by re-using memory (#11147) 2022-08-19 15:27:52 +05:30
alerting_test.go Use atomic field avoid (*AlertingRule).mtx wait when template expanding (#10858) 2022-07-19 12:58:37 +02:00
manager.go refactor (rules): move from github.com/pkg/errors to 'errors' and 'fmt' (#10855) 2022-06-17 09:54:25 +02:00
manager_test.go Use atomic field avoid (*AlertingRule).mtx wait when template expanding (#10858) 2022-07-19 12:58:37 +02:00
recording.go Optimise relabeling by re-using memory (#11147) 2022-08-19 15:27:52 +05:30
recording_test.go rules: remove classic UI code (#10730) 2022-05-23 16:21:50 +02:00