Implement helpers to assert Prometheus metrics and upgrade prometheus/client_golang package
Gitaly is using CollectAndCompare
test utility to assert Prometheus
metrics. This helper has two problems:
- It requires a list of asserting metrics. Most of the time, the input string contains all the metrics needed to be asserted. The cases where we assert a subset of the metrics are quite rare.
- It doesn't handle histograms well, especially when a histogram is used to record elapsed time.
In prom client version v1.20.0 (https://github.com/prometheus/client_golang/releases/tag/v1.20.0), the library updates this API so that it's not feasible to assert a portion of histogram metrics.
This MR implements some helpers to simplify metrics assertion as well as deal with histogram metrics better. It also bumps client_golang to v1.20.
Edited by Quang-Minh Nguyen