prometheus/promql
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
..
fuzz-data
parser Adds day_of_year function to PromQL 2022-05-20 14:08:34 +02:00
testdata Adds day_of_year function to PromQL 2022-05-20 14:08:34 +02:00
bench_test.go Track and report Samples Queried per query 2022-03-21 23:49:17 +01:00
engine.go Labels: optimise creation of signature with/without labels (#10667) 2022-06-07 10:08:27 +05:30
engine_test.go Preallocate Labels in labels.Builder (#10749) 2022-05-25 16:22:47 +02:00
functions.go Labels: optimise creation of signature with/without labels (#10667) 2022-06-07 10:08:27 +05:30
functions_test.go Avoid literal integer overflows in 32 bit arches. 2022-03-29 22:51:20 +02:00
fuzz.go error for invalid media type should not be completely swallowed (#10186) 2022-02-08 10:57:56 +01:00
fuzz_test.go error for invalid media type should not be completely swallowed (#10186) 2022-02-08 10:57:56 +01:00
promql_test.go add doc 2022-02-13 21:59:03 +08:00
quantile.go address comment 2022-02-15 22:09:17 +08:00
query_logger.go Improve error logging for missing config and QL dir (#10260) 2022-02-16 17:43:15 +01:00
query_logger_test.go refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
test.go refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
test_test.go Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
value.go Promql: Add clarifying note to Point.MarshalJSON 2021-11-25 13:32:37 +01:00