Skip to content

Commit c17264e

Browse files
krajoramarenovate[bot]aknuds1
authored
chore(deps): vendor update mimir-prometheus at 5e9a771537ba (#9622)
* Test client_golang 1.20.5 Signed-off-by: György Krajcsovits <[email protected]> * Revert "Add tests for pkg/util/test.AssertGatherAndCompare (#9543)" This reverts commit e78254e. * Revert "Update module github.com/prometheus/client_golang to v1.20.4 (main) (#9307)" This reverts commit cd1294b. # Conflicts: # go.sum # vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go # vendor/modules.txt * Clear go.mod replace Signed-off-by: György Krajcsovits <[email protected]> * Update mimir-prometheus at 5e9a771537ba To get grafana/mimir-prometheus#718 client_golang update to 1.20.5 to revert breaking changes to test utils. Signed-off-by: György Krajcsovits <[email protected]> * Apply suggestions from code review Co-authored-by: Arve Knudsen <[email protected]> * Apply suggestions Signed-off-by: György Krajcsovits <[email protected]> --------- Signed-off-by: György Krajcsovits <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Arve Knudsen <[email protected]>
1 parent 8ade0db commit c17264e

File tree

13 files changed

+119
-278
lines changed

13 files changed

+119
-278
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b
3535
github.com/pkg/errors v0.9.1
3636
github.com/prometheus/alertmanager v0.27.0
37-
github.com/prometheus/client_golang v1.20.4
37+
github.com/prometheus/client_golang v1.20.5
3838
github.com/prometheus/client_model v0.6.1
3939
github.com/prometheus/common v0.59.1
4040
github.com/prometheus/prometheus v1.99.0
@@ -282,7 +282,7 @@ require (
282282
)
283283

284284
// Using a fork of Prometheus with Mimir-specific changes.
285-
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20241015102654-eaa7eae2d877
285+
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20241016140351-5e9a771537ba
286286

287287
// Replace memberlist with our fork which includes some fixes that haven't been
288288
// merged upstream yet:

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,8 @@ github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56 h1:X8IKQ0wu40wp
12701270
github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU=
12711271
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe h1:yIXAAbLswn7VNWBIvM71O2QsgfgW9fRXZNR0DXe6pDU=
12721272
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
1273-
github.com/grafana/mimir-prometheus v0.0.0-20241015102654-eaa7eae2d877 h1:HRrL6+agPwe5uuKwI7mdR8f5rUERPB8HuDw3UX10kHM=
1274-
github.com/grafana/mimir-prometheus v0.0.0-20241015102654-eaa7eae2d877/go.mod h1:oyDm7JaLUh+QGuGkC7iXC8IyTUq5rlh1ba2CRm9DlVg=
1273+
github.com/grafana/mimir-prometheus v0.0.0-20241016140351-5e9a771537ba h1:vTiUTY+yGoXJAxKA8h2GC6ynHoxbuMjTdp/pVrXlE/E=
1274+
github.com/grafana/mimir-prometheus v0.0.0-20241016140351-5e9a771537ba/go.mod h1:AvqWbZV+ePQxe3xQT4IX1iP1/evmMJKI7sNxzx20S6Y=
12751275
github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 h1:em1oddjXL8c1tL0iFdtVtPloq2hRPen2MJQKoAWpxu0=
12761276
github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU=
12771277
github.com/grafana/prometheus-alertmanager v0.25.1-0.20240924175849-b8b7c2c74eb6 h1:nT8QXdJo6wHMBcF0xEoXxEWkoUZOyzV/jyi/u9l7YEk=
@@ -1583,8 +1583,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O
15831583
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
15841584
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
15851585
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
1586-
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
1587-
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
1586+
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
1587+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
15881588
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
15891589
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
15901590
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

pkg/compactor/blocks_cleaner_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,12 @@ func TestBlocksCleaner_ShouldNotCleanupUserThatDoesntBelongToShardAnymore(t *tes
464464
require.ElementsMatch(t, []string{"user-1", "user-2"}, cleaner.lastOwnedUsers)
465465

466466
// But there are no metrics for any user, because we did not in fact clean them.
467-
test.AssertGatherAndCompare(t, reg, "", "cortex_bucket_blocks_count")
467+
assert.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
468+
# HELP cortex_bucket_blocks_count Total number of blocks in the bucket. Includes blocks marked for deletion, but not partial blocks.
469+
# TYPE cortex_bucket_blocks_count gauge
470+
`),
471+
"cortex_bucket_blocks_count",
472+
))
468473

469474
// Running cleanUsers again will see that users are no longer owned.
470475
require.NoError(t, cleaner.runCleanupWithErr(ctx))

pkg/compactor/compactor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func TestMultitenantCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t
967967
"cortex_compactor_block_cleanup_started_total", "cortex_compactor_block_cleanup_completed_total", "cortex_compactor_block_cleanup_failed_total",
968968
"cortex_bucket_blocks_count", "cortex_bucket_blocks_marked_for_deletion_count", "cortex_bucket_index_last_successful_update_timestamp_seconds",
969969
}
970-
testutil.AssertGatherAndCompare(t, registry, `
970+
assert.NoError(t, prom_testutil.GatherAndCompare(registry, strings.NewReader(`
971971
# TYPE cortex_compactor_runs_started_total counter
972972
# HELP cortex_compactor_runs_started_total Total number of compaction runs started.
973973
cortex_compactor_runs_started_total 1
@@ -1006,7 +1006,7 @@ func TestMultitenantCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t
10061006
# TYPE cortex_compactor_block_cleanup_failed_total counter
10071007
# HELP cortex_compactor_block_cleanup_failed_total Total number of blocks cleanup runs failed.
10081008
cortex_compactor_block_cleanup_failed_total 0
1009-
`, testedMetrics...)
1009+
`), testedMetrics...))
10101010
}
10111011

10121012
func TestMultitenantCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunning(t *testing.T) {

pkg/distributor/distributor_test.go

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func TestDistributor_MetricsCleanup(t *testing.T) {
377377
d.latestSeenSampleTimestampPerUser.WithLabelValues("userA").Set(1111)
378378
d.labelValuesWithNewlinesPerUser.WithLabelValues("userA").Inc()
379379

380-
util_test.AssertGatherAndCompare(t, reg, `
380+
require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
381381
# HELP cortex_distributor_deduped_samples_total The total number of deduplicated samples.
382382
# TYPE cortex_distributor_deduped_samples_total counter
383383
cortex_distributor_deduped_samples_total{cluster="cluster1",user="userA"} 1
@@ -420,11 +420,23 @@ func TestDistributor_MetricsCleanup(t *testing.T) {
420420
# HELP cortex_distributor_label_values_with_newlines_total Total number of label values with newlines seen at ingestion time.
421421
# TYPE cortex_distributor_label_values_with_newlines_total counter
422422
cortex_distributor_label_values_with_newlines_total{user="userA"} 1
423-
`, metrics...)
423+
`), metrics...))
424424

425425
d.cleanupInactiveUser("userA")
426426

427-
util_test.AssertGatherAndCompare(t, reg, `
427+
require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
428+
# HELP cortex_distributor_deduped_samples_total The total number of deduplicated samples.
429+
# TYPE cortex_distributor_deduped_samples_total counter
430+
431+
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
432+
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
433+
434+
# HELP cortex_distributor_metadata_in_total The total number of metadata the have come in to the distributor, including rejected.
435+
# TYPE cortex_distributor_metadata_in_total counter
436+
437+
# HELP cortex_distributor_non_ha_samples_received_total The total number of received samples for a user that has HA tracking turned on, but the sample didn't contain both HA labels.
438+
# TYPE cortex_distributor_non_ha_samples_received_total counter
439+
428440
# HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected.
429441
# TYPE cortex_distributor_received_metadata_total counter
430442
cortex_distributor_received_metadata_total{user="userB"} 10
@@ -436,7 +448,16 @@ func TestDistributor_MetricsCleanup(t *testing.T) {
436448
# HELP cortex_distributor_received_exemplars_total The total number of received exemplars, excluding rejected and deduped exemplars.
437449
# TYPE cortex_distributor_received_exemplars_total counter
438450
cortex_distributor_received_exemplars_total{user="userB"} 10
439-
`, metrics...)
451+
452+
# HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples.
453+
# TYPE cortex_distributor_samples_in_total counter
454+
455+
# HELP cortex_distributor_exemplars_in_total The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars.
456+
# TYPE cortex_distributor_exemplars_in_total counter
457+
458+
# HELP cortex_distributor_label_values_with_newlines_total Total number of label values with newlines seen at ingestion time.
459+
# TYPE cortex_distributor_label_values_with_newlines_total counter
460+
`), metrics...))
440461
}
441462

442463
func TestDistributor_PushRequestRateLimiter(t *testing.T) {
@@ -1666,7 +1687,7 @@ func TestDistributor_ExemplarValidation(t *testing.T) {
16661687
}
16671688

16681689
assert.Equal(t, tc.expectedExemplars, tc.req.Timeseries)
1669-
util_test.AssertGatherAndCompare(t, regs[0], tc.expectedMetrics, "cortex_discarded_exemplars_total")
1690+
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(tc.expectedMetrics), "cortex_discarded_exemplars_total"))
16701691
})
16711692
}
16721693
}
@@ -7169,15 +7190,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
71697190
happyIngesters: 3,
71707191
replicationFactor: 3,
71717192
})
7172-
util_test.AssertGatherAndCompare(t, regs[0], `
7193+
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
71737194
# HELP cortex_distributor_replication_factor The configured replication factor.
71747195
# TYPE cortex_distributor_replication_factor gauge
71757196
cortex_distributor_replication_factor 3
71767197
71777198
# HELP cortex_distributor_ingest_storage_enabled Whether writes are being processed via ingest storage. Equal to 1 if ingest storage is enabled, 0 if disabled.
71787199
# TYPE cortex_distributor_ingest_storage_enabled gauge
71797200
cortex_distributor_ingest_storage_enabled 0
7180-
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
7201+
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
71817202
})
71827203

71837204
t.Run("migration to ingest storage", func(t *testing.T) {
@@ -7190,15 +7211,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
71907211
happyIngesters: 3,
71917212
replicationFactor: 3,
71927213
})
7193-
util_test.AssertGatherAndCompare(t, regs[0], `
7214+
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
71947215
# HELP cortex_distributor_replication_factor The configured replication factor.
71957216
# TYPE cortex_distributor_replication_factor gauge
71967217
cortex_distributor_replication_factor 3
71977218
71987219
# HELP cortex_distributor_ingest_storage_enabled Whether writes are being processed via ingest storage. Equal to 1 if ingest storage is enabled, 0 if disabled.
71997220
# TYPE cortex_distributor_ingest_storage_enabled gauge
72007221
cortex_distributor_ingest_storage_enabled 1
7201-
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
7222+
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
72027223
})
72037224

72047225
t.Run("ingest storage", func(t *testing.T) {
@@ -7210,11 +7231,11 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
72107231
happyIngesters: 3,
72117232
replicationFactor: 3,
72127233
})
7213-
util_test.AssertGatherAndCompare(t, regs[0], `
7234+
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
72147235
# HELP cortex_distributor_ingest_storage_enabled Whether writes are being processed via ingest storage. Equal to 1 if ingest storage is enabled, 0 if disabled.
72157236
# TYPE cortex_distributor_ingest_storage_enabled gauge
72167237
cortex_distributor_ingest_storage_enabled 1
7217-
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
7238+
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
72187239
})
72197240
}
72207241

pkg/frontend/v1/frontend_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040
"github.com/grafana/mimir/pkg/querier/stats"
4141
querier_worker "github.com/grafana/mimir/pkg/querier/worker"
4242
"github.com/grafana/mimir/pkg/scheduler/queue"
43-
util_test "github.com/grafana/mimir/pkg/util/test"
4443
)
4544

4645
const (
@@ -223,7 +222,10 @@ func TestFrontendMetricsCleanup(t *testing.T) {
223222

224223
fr.cleanupInactiveUserMetrics("1")
225224

226-
util_test.AssertGatherAndCompare(t, reg, "", "cortex_query_frontend_queue_length")
225+
require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
226+
# HELP cortex_query_frontend_queue_length Number of queries in the queue.
227+
# TYPE cortex_query_frontend_queue_length gauge
228+
`), "cortex_query_frontend_queue_length"))
227229
}
228230

229231
testFrontend(t, defaultFrontendConfig(), handler, test, nil, reg)

0 commit comments

Comments
 (0)