prometheus/model
Bryan Boreham 2e2c014d52
Labels: optimise creation of signature with/without labels (#10667)
* Labels: create signature with/without labels

Instead of creating a new Labels slice then converting to signature,
go directly to the signature and save time.

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

* Labels: refactor Builder tests

Have one test with a range of cases, and have them check the final
output rather than checking the internal structure of the Builder.

Also add a couple of cases where the value is "", which should be
interpreted as 'delete'.

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

* Labels: add 'Keep' function to Builder

This lets us replace `Labels.WithLabels` with the more general `Builder`.

In `engine.resultMetric()` we can call `Keep()` instead of checking
and calling `Del()`.

Avoid calling `Sort()` in `Builder.Labels()` if we didn't add anything,
so that `Keep()` has the same performance as `WithLabels()`.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-06-07 10:08:27 +05:30
..
exemplar Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
labels Labels: optimise creation of signature with/without labels (#10667) 2022-06-07 10:08:27 +05:30
relabel Add lowercase and uppercase relabel action (#10641) 2022-05-03 10:09:53 +02:00
rulefmt refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
textparse refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
timestamp Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
value Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00