prometheus/promql
Oleg Zaytsev 6e2905a4d4
Use zeropool.Pool to workaround SA6002 (#12189)
* Use zeropool.Pool to workaround SA6002

I built a tiny library called https://github.com/colega/zeropool to
workaround the SA6002 staticheck issue.

While searching for the references of that SA6002 staticheck issues on
Github first results was Prometheus itself, with quite a lot of ignores
of it.

This changes the usages of `sync.Pool` to `zeropool.Pool[T]` where a
pointer is not available.

Also added a benchmark for HeadAppender Append/Commit when series
already exist, which is one of the most usual cases IMO, as I didn't find
any.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Improve BenchmarkHeadAppender with more cases

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* A little copying is better than a little dependency

https://www.youtube.com/watch?v=PAAkCSZUG1c&t=9m28s

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Fix imports order

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Add license header

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Copyright should be on one of the first 3 lines

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Use require.Equal for testing

I don't depend on testify in my lib, but here we have it available.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Avoid flaky test

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Also use zeropool for pointsPool in engine.go

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

---------

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-03-29 20:34:34 +01:00
..
fuzz-data textparse: Add fuzzing and fix bug caught 2017-07-07 11:12:17 +02:00
parser Update tests 2023-03-08 16:32:39 +01:00
testdata Adds day_of_year function to PromQL 2022-05-20 14:08:34 +02:00
bench_test.go promql: add benchmark for match against blank string 2023-01-05 14:05:54 +00:00
engine.go Use zeropool.Pool to workaround SA6002 (#12189) 2023-03-29 20:34:34 +01:00
engine_test.go promql: set CounterResetHint after rate and sum 2023-03-14 14:21:59 -06:00
functions.go promql: set CounterResetHint after rate and sum 2023-03-14 14:21:59 -06:00
functions_test.go Avoid literal integer overflows in 32 bit arches. 2022-03-29 22:51:20 +02:00
fuzz.go refactor (promql): move from github.com/pkg/errors to 'errors' and 'fmt' (#10817) 2022-06-08 10:47:52 +02: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 promql: disable some slow cases in TestConcurrentRangeQueries 2023-03-08 14:28:30 +00:00
quantile.go histogram: Modify getBound to deal properly with infinity 2022-10-06 17:40:03 +02:00
query_logger.go Close file descriptor in query logging (#11148) 2022-08-17 15:27:27 +05:30
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 Update package promql tests for new labels.Labels type 2022-12-19 15:22:09 +00:00
test_test.go Update package promql tests for new labels.Labels type 2022-12-19 15:22:09 +00:00
value.go typo 'efficcient' (#12090) 2023-03-08 09:59:08 +00:00
value_test.go Shortcut ContainsSameLabelset() (#11000) 2022-07-13 15:18:10 +05:30