Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): vendor update mimir-prometheus at 5e9a771537ba #9622

Merged
merged 8 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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.4
github.com/prometheus/client_golang v1.20.5
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 @@ -282,7 +282,7 @@ require (
)

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

// Replace memberlist with our fork which includes some fixes that haven't been
// merged upstream yet:
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,8 @@ github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56 h1:X8IKQ0wu40wp
github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe h1:yIXAAbLswn7VNWBIvM71O2QsgfgW9fRXZNR0DXe6pDU=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/grafana/mimir-prometheus v0.0.0-20241015102654-eaa7eae2d877 h1:HRrL6+agPwe5uuKwI7mdR8f5rUERPB8HuDw3UX10kHM=
github.com/grafana/mimir-prometheus v0.0.0-20241015102654-eaa7eae2d877/go.mod h1:oyDm7JaLUh+QGuGkC7iXC8IyTUq5rlh1ba2CRm9DlVg=
github.com/grafana/mimir-prometheus v0.0.0-20241016140351-5e9a771537ba h1:vTiUTY+yGoXJAxKA8h2GC6ynHoxbuMjTdp/pVrXlE/E=
github.com/grafana/mimir-prometheus v0.0.0-20241016140351-5e9a771537ba/go.mod h1:AvqWbZV+ePQxe3xQT4IX1iP1/evmMJKI7sNxzx20S6Y=
github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 h1:em1oddjXL8c1tL0iFdtVtPloq2hRPen2MJQKoAWpxu0=
github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU=
github.com/grafana/prometheus-alertmanager v0.25.1-0.20240924175849-b8b7c2c74eb6 h1:nT8QXdJo6wHMBcF0xEoXxEWkoUZOyzV/jyi/u9l7YEk=
Expand Down Expand Up @@ -1583,8 +1583,8 @@ github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3O
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
7 changes: 6 additions & 1 deletion pkg/compactor/blocks_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,12 @@ 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.
test.AssertGatherAndCompare(t, reg, "", "cortex_bucket_blocks_count")
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",
))

// 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",
}
testutil.AssertGatherAndCompare(t, registry, `
assert.NoError(t, prom_testutil.GatherAndCompare(registry, strings.NewReader(`
# 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: 32 additions & 11 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()

util_test.AssertGatherAndCompare(t, reg, `
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
cortex_distributor_deduped_samples_total{cluster="cluster1",user="userA"} 1
Expand Down Expand Up @@ -420,11 +420,23 @@ 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")

util_test.AssertGatherAndCompare(t, reg, `
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

# 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 @@ -436,7 +448,16 @@ 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
`, metrics...)

# 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...))
}

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

assert.Equal(t, tc.expectedExemplars, tc.req.Timeseries)
util_test.AssertGatherAndCompare(t, regs[0], tc.expectedMetrics, "cortex_discarded_exemplars_total")
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(tc.expectedMetrics), "cortex_discarded_exemplars_total"))
})
}
}
Expand Down Expand Up @@ -7169,15 +7190,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
util_test.AssertGatherAndCompare(t, regs[0], `
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
# 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 @@ -7190,15 +7211,15 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
util_test.AssertGatherAndCompare(t, regs[0], `
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
# 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 @@ -7210,11 +7231,11 @@ func TestDistributor_StorageConfigMetrics(t *testing.T) {
happyIngesters: 3,
replicationFactor: 3,
})
util_test.AssertGatherAndCompare(t, regs[0], `
assert.NoError(t, testutil.GatherAndCompare(regs[0], strings.NewReader(`
# 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: 4 additions & 2 deletions pkg/frontend/v1/frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ 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 @@ -223,7 +222,10 @@ func TestFrontendMetricsCleanup(t *testing.T) {

fr.cleanupInactiveUserMetrics("1")

util_test.AssertGatherAndCompare(t, reg, "", "cortex_query_frontend_queue_length")
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"))
}

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