Skip to content

Commit 504ad9b

Browse files
committed
Cut 1.20.5; update comments.
Signed-off-by: bwplotka <[email protected]> # Conflicts: # CHANGELOG.md
1 parent 584a7ce commit 504ad9b

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Unreleased
22

3+
## 1.20.5 / 2024-10-15
4+
5+
* [BUGFIX] testutil: Reverted #1424; functions using compareMetricFamilies are (again) only failing if filtered metricNames are in the expected input.
6+
7+
## 1.20.4 / 2024-09-07
8+
39
* [BUGFIX] histograms: Fix possible data race when appending exemplars vs metrics gather. #1623
410

511
## 1.20.3 / 2024-09-05
@@ -28,7 +34,7 @@
2834
* [FEATURE] promlint: Add duplicated metric lint rule. #1472
2935
* [BUGFIX] promlint: Relax metric type in name linter rule. #1455
3036
* [BUGFIX] promhttp: Make sure server instrumentation wrapping supports new and future extra responseWriter methods. #1480
31-
* [BUGFIX] testutil: Functions using compareMetricFamilies are now failing if filtered metricNames are not in the input. #1424
37+
* [BUGFIX] **breaking** testutil: Functions using compareMetricFamilies are now failing if filtered metricNames are not in the input. #1424 (reverted in 1.20.5)
3238

3339
## 1.19.0 / 2024-02-27
3440

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.20.2
1+
1.20.5

prometheus/testutil/testutil.go

+12
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ func GatherAndCount(g prometheus.Gatherer, metricNames ...string) (int, error) {
158158
// ScrapeAndCompare calls a remote exporter's endpoint which is expected to return some metrics in
159159
// plain text format. Then it compares it with the results that the `expected` would return.
160160
// If the `metricNames` is not empty it would filter the comparison only to the given metric names.
161+
//
162+
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
163+
// both expected and scraped metrics. See https://github.com/prometheus/client_golang/issues/1351.
161164
func ScrapeAndCompare(url string, expected io.Reader, metricNames ...string) error {
162165
resp, err := http.Get(url)
163166
if err != nil {
@@ -185,6 +188,9 @@ func ScrapeAndCompare(url string, expected io.Reader, metricNames ...string) err
185188

186189
// CollectAndCompare collects the metrics identified by `metricNames` and compares them in the Prometheus text
187190
// exposition format to the data read from expected.
191+
//
192+
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
193+
// both expected and collected metrics. See https://github.com/prometheus/client_golang/issues/1351.
188194
func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error {
189195
reg := prometheus.NewPedanticRegistry()
190196
if err := reg.Register(c); err != nil {
@@ -197,6 +203,9 @@ func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames .
197203
// it to an expected output read from the provided Reader in the Prometheus text
198204
// exposition format. If any metricNames are provided, only metrics with those
199205
// names are compared.
206+
//
207+
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
208+
// both expected and gathered metrics. See https://github.com/prometheus/client_golang/issues/1351.
200209
func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...string) error {
201210
return TransactionalGatherAndCompare(prometheus.ToTransactionalGatherer(g), expected, metricNames...)
202211
}
@@ -205,6 +214,9 @@ func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...
205214
// it to an expected output read from the provided Reader in the Prometheus text
206215
// exposition format. If any metricNames are provided, only metrics with those
207216
// names are compared.
217+
//
218+
// NOTE: Be mindful of accidental discrepancies between expected and metricNames; metricNames filter
219+
// both expected and gathered metrics. See https://github.com/prometheus/client_golang/issues/1351.
208220
func TransactionalGatherAndCompare(g prometheus.TransactionalGatherer, expected io.Reader, metricNames ...string) error {
209221
got, done, err := g.Gather()
210222
defer done()

0 commit comments

Comments
 (0)