Skip to content

Commit

Permalink
Update module github.com/prometheus/client_golang to v1.20.4 (main) (#…
Browse files Browse the repository at this point in the history
…9307)

* Update module github.com/prometheus/client_golang to v1.20.4

---------

Signed-off-by: Arve Knudsen <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Arve Knudsen <[email protected]>
  • Loading branch information
renovate[bot] and aknuds1 authored Oct 7, 2024
1 parent 320ca98 commit cd1294b
Show file tree
Hide file tree
Showing 34 changed files with 978 additions and 318 deletions.
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b
github.com/pkg/errors v0.9.1
github.com/prometheus/alertmanager v0.27.0
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/client_golang v1.20.4
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.59.1
github.com/prometheus/prometheus v1.99.0
Expand Down Expand Up @@ -284,10 +284,6 @@ require (
// Using a fork of Prometheus with Mimir-specific changes.
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20241003114040-35ec40c3b27a

// client_golang v1.20.3 has some data races in histogram exemplars.
// Stick to v1.19.1 until they are fixed.
replace github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.19.1

// Replace memberlist with our fork which includes some fixes that haven't been
// merged upstream yet:
// - https://github.com/hashicorp/memberlist/pull/260
Expand Down
51 changes: 43 additions & 8 deletions go.sum

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions pkg/compactor/blocks_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,7 @@ func TestBlocksCleaner_ShouldNotCleanupUserThatDoesntBelongToShardAnymore(t *tes
require.ElementsMatch(t, []string{"user-1", "user-2"}, cleaner.lastOwnedUsers)

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

// Running cleanUsers again will see that users are no longer owned.
require.NoError(t, cleaner.runCleanupWithErr(ctx))
Expand Down
4 changes: 2 additions & 2 deletions pkg/compactor/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ func TestMultitenantCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t
"cortex_compactor_block_cleanup_started_total", "cortex_compactor_block_cleanup_completed_total", "cortex_compactor_block_cleanup_failed_total",
"cortex_bucket_blocks_count", "cortex_bucket_blocks_marked_for_deletion_count", "cortex_bucket_index_last_successful_update_timestamp_seconds",
}
assert.NoError(t, prom_testutil.GatherAndCompare(registry, strings.NewReader(`
testutil.AssertGatherAndCompare(t, registry, `
# TYPE cortex_compactor_runs_started_total counter
# HELP cortex_compactor_runs_started_total Total number of compaction runs started.
cortex_compactor_runs_started_total 1
Expand Down Expand Up @@ -1006,7 +1006,7 @@ func TestMultitenantCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t
# TYPE cortex_compactor_block_cleanup_failed_total counter
# HELP cortex_compactor_block_cleanup_failed_total Total number of blocks cleanup runs failed.
cortex_compactor_block_cleanup_failed_total 0
`), testedMetrics...))
`, testedMetrics...)
}

func TestMultitenantCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunning(t *testing.T) {
Expand Down
43 changes: 11 additions & 32 deletions pkg/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func TestDistributor_MetricsCleanup(t *testing.T) {
d.latestSeenSampleTimestampPerUser.WithLabelValues("userA").Set(1111)
d.labelValuesWithNewlinesPerUser.WithLabelValues("userA").Inc()

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

d.cleanupInactiveUser("userA")

require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
# HELP cortex_distributor_deduped_samples_total The total number of deduplicated samples.
# TYPE cortex_distributor_deduped_samples_total counter
# HELP cortex_distributor_latest_seen_sample_timestamp_seconds Unix timestamp of latest received sample per user.
# TYPE cortex_distributor_latest_seen_sample_timestamp_seconds gauge
# HELP cortex_distributor_metadata_in_total The total number of metadata the have come in to the distributor, including rejected.
# TYPE cortex_distributor_metadata_in_total counter
# 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.
# TYPE cortex_distributor_non_ha_samples_received_total counter
util_test.AssertGatherAndCompare(t, reg, `
# HELP cortex_distributor_received_metadata_total The total number of received metadata, excluding rejected.
# TYPE cortex_distributor_received_metadata_total counter
cortex_distributor_received_metadata_total{user="userB"} 10
Expand All @@ -448,16 +436,7 @@ func TestDistributor_MetricsCleanup(t *testing.T) {
# HELP cortex_distributor_received_exemplars_total The total number of received exemplars, excluding rejected and deduped exemplars.
# TYPE cortex_distributor_received_exemplars_total counter
cortex_distributor_received_exemplars_total{user="userB"} 10
# HELP cortex_distributor_samples_in_total The total number of samples that have come in to the distributor, including rejected or deduped samples.
# TYPE cortex_distributor_samples_in_total counter
# HELP cortex_distributor_exemplars_in_total The total number of exemplars that have come in to the distributor, including rejected or deduped exemplars.
# TYPE cortex_distributor_exemplars_in_total counter
# HELP cortex_distributor_label_values_with_newlines_total Total number of label values with newlines seen at ingestion time.
# TYPE cortex_distributor_label_values_with_newlines_total counter
`), metrics...))
`, metrics...)
}

func TestDistributor_PushRequestRateLimiter(t *testing.T) {
Expand Down Expand Up @@ -1687,7 +1666,7 @@ func TestDistributor_ExemplarValidation(t *testing.T) {
}

assert.Equal(t, tc.expectedExemplars, tc.req.Timeseries)
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(tc.expectedMetrics), "cortex_discarded_exemplars_total"))
util_test.AssertGatherAndCompare(t, regs[0], tc.expectedMetrics, "cortex_discarded_exemplars_total")
})
}
}
Expand Down Expand Up @@ -7190,15 +7169,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
util_test.AssertGatherAndCompare(t, regs[0], `
# HELP cortex_distributor_replication_factor The configured replication factor.
# TYPE cortex_distributor_replication_factor gauge
cortex_distributor_replication_factor 3
# 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.
# TYPE cortex_distributor_ingest_storage_enabled gauge
cortex_distributor_ingest_storage_enabled 0
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
})

t.Run("migration to ingest storage", func(t *testing.T) {
Expand All @@ -7211,15 +7190,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
util_test.AssertGatherAndCompare(t, regs[0], `
# HELP cortex_distributor_replication_factor The configured replication factor.
# TYPE cortex_distributor_replication_factor gauge
cortex_distributor_replication_factor 3
# 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.
# TYPE cortex_distributor_ingest_storage_enabled gauge
cortex_distributor_ingest_storage_enabled 1
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
})

t.Run("ingest storage", func(t *testing.T) {
Expand All @@ -7231,11 +7210,11 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
util_test.AssertGatherAndCompare(t, regs[0], `
# 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.
# TYPE cortex_distributor_ingest_storage_enabled gauge
cortex_distributor_ingest_storage_enabled 1
`), "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled"))
`, "cortex_distributor_replication_factor", "cortex_distributor_ingest_storage_enabled")
})
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/frontend/v1/frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/grafana/mimir/pkg/querier/stats"
querier_worker "github.com/grafana/mimir/pkg/querier/worker"
"github.com/grafana/mimir/pkg/scheduler/queue"
util_test "github.com/grafana/mimir/pkg/util/test"
)

const (
Expand Down Expand Up @@ -222,10 +223,7 @@ func TestFrontendMetricsCleanup(t *testing.T) {

fr.cleanupInactiveUserMetrics("1")

require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
# HELP cortex_query_frontend_queue_length Number of queries in the queue.
# TYPE cortex_query_frontend_queue_length gauge
`), "cortex_query_frontend_queue_length"))
util_test.AssertGatherAndCompare(t, reg, "", "cortex_query_frontend_queue_length")
}

testFrontend(t, defaultFrontendConfig(), handler, test, nil, reg)
Expand Down
Loading

0 comments on commit cd1294b

Please sign in to comment.