Cut 1.20.2; update comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
parent
f3d6c5d959
commit
ebddeda5d8
|
@ -1,5 +1,9 @@
|
|||
## Unreleased
|
||||
|
||||
## 1.20.2 / 2024-10-15
|
||||
|
||||
* [BUGFIX] testutil: Reverted functions using compareMetricFamilies are now failing if filtered metricNames are not in the input.
|
||||
|
||||
## 1.20.1 / 2024-08-20
|
||||
|
||||
* [BUGFIX] process-collector: Fixed unregistered descriptor error when using process collector with `PedanticRegistry` on linux machines. #1587
|
||||
|
@ -18,7 +22,7 @@
|
|||
* [FEATURE] promlint: Add duplicated metric lint rule. #1472
|
||||
* [BUGFIX] promlint: Relax metric type in name linter rule. #1455
|
||||
* [BUGFIX] promhttp: Make sure server instrumentation wrapping supports new and future extra responseWriter methods. #1480
|
||||
* [BUGFIX] testutil: Functions using compareMetricFamilies are now failing if filtered metricNames are not in the input. #1424
|
||||
* [BUGFIX] **breaking** testutil: Functions using compareMetricFamilies are now failing if filtered metricNames are not in the input. #1424 (reverted in 1.20.2)
|
||||
|
||||
## 1.19.0 / 2024-02-27
|
||||
|
||||
|
|
|
@ -158,6 +158,9 @@ func GatherAndCount(g prometheus.Gatherer, metricNames ...string) (int, error) {
|
|||
// ScrapeAndCompare calls a remote exporter's endpoint which is expected to return some metrics in
|
||||
// plain text format. Then it compares it with the results that the `expected` would return.
|
||||
// If the `metricNames` is not empty it would filter the comparison only to the given metric names.
|
||||
//
|
||||
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
|
||||
// both expected and scraped metrics. See https://github.com/prometheus/client_golang/issues/1351.
|
||||
func ScrapeAndCompare(url string, expected io.Reader, metricNames ...string) error {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
|
@ -185,6 +188,9 @@ func ScrapeAndCompare(url string, expected io.Reader, metricNames ...string) err
|
|||
|
||||
// CollectAndCompare collects the metrics identified by `metricNames` and compares them in the Prometheus text
|
||||
// exposition format to the data read from expected.
|
||||
//
|
||||
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
|
||||
// both expected and collected metrics. See https://github.com/prometheus/client_golang/issues/1351.
|
||||
func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error {
|
||||
reg := prometheus.NewPedanticRegistry()
|
||||
if err := reg.Register(c); err != nil {
|
||||
|
@ -197,6 +203,9 @@ func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames .
|
|||
// it to an expected output read from the provided Reader in the Prometheus text
|
||||
// exposition format. If any metricNames are provided, only metrics with those
|
||||
// names are compared.
|
||||
//
|
||||
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
|
||||
// both expected and gathered metrics. See https://github.com/prometheus/client_golang/issues/1351.
|
||||
func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...string) error {
|
||||
return TransactionalGatherAndCompare(prometheus.ToTransactionalGatherer(g), expected, metricNames...)
|
||||
}
|
||||
|
@ -205,6 +214,9 @@ func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...
|
|||
// it to an expected output read from the provided Reader in the Prometheus text
|
||||
// exposition format. If any metricNames are provided, only metrics with those
|
||||
// names are compared.
|
||||
//
|
||||
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
|
||||
// both expected and gathered metrics. See https://github.com/prometheus/client_golang/issues/1351.
|
||||
func TransactionalGatherAndCompare(g prometheus.TransactionalGatherer, expected io.Reader, metricNames ...string) error {
|
||||
got, done, err := g.Gather()
|
||||
defer done()
|
||||
|
|
Loading…
Reference in New Issue