diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e68970666..4efe946c78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ## Unreleased +## [v0.30.1](https://github.com/thanos-io/thanos/tree/release-0.30) - 4.01.2023 + +### Fixed + +- [#6009](https://github.com/thanos-io/thanos/pull/6009) Query Frontend/Store: fix duplicate metrics registration in Redis client + ## [v0.30.0](https://github.com/thanos-io/thanos/tree/release-0.30) - 2.01.2023 NOTE: Querier's `query.promql-engine` flag enabling new PromQL engine is now unhidden. We encourage users to use new experimental PromQL engine for efficiency reasons. diff --git a/VERSION b/VERSION index c25c8e5b74..1a44cad74d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.30.0 +0.30.1 diff --git a/pkg/cacheutil/cacheutil_test.go b/pkg/cacheutil/cacheutil_test.go index 2eadea1871..d47a997972 100644 --- a/pkg/cacheutil/cacheutil_test.go +++ b/pkg/cacheutil/cacheutil_test.go @@ -16,7 +16,11 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) + goleak.VerifyTestMain( + m, + // https://github.com/rueian/rueidis/blob/v0.0.90/pipe.go#L204. + goleak.IgnoreTopFunction("github.com/rueian/rueidis.(*pipe).backgroundPing"), + ) } func TestDoWithBatch(t *testing.T) { diff --git a/pkg/cacheutil/redis_client.go b/pkg/cacheutil/redis_client.go index ba1b5eee2d..eb5afb5b59 100644 --- a/pkg/cacheutil/redis_client.go +++ b/pkg/cacheutil/redis_client.go @@ -175,6 +175,10 @@ func NewRedisClientWithConfig(logger log.Logger, name string, config RedisClient return nil, err } + if reg != nil { + reg = prometheus.WrapRegistererWith(prometheus.Labels{"name": name}, reg) + } + var tlsConfig *tls.Config if config.TLSEnabled { userTLSConfig := config.TLSConfig diff --git a/pkg/cacheutil/redis_client_test.go b/pkg/cacheutil/redis_client_test.go index 6b7ca51d6a..79b72dfe61 100644 --- a/pkg/cacheutil/redis_client_test.go +++ b/pkg/cacheutil/redis_client_test.go @@ -212,3 +212,19 @@ func TestValidateRedisConfig(t *testing.T) { } } + +func TestMultipleRedisClient(t *testing.T) { + s, err := miniredis.Run() + if err != nil { + testutil.Ok(t, err) + } + defer s.Close() + cfg := DefaultRedisClientConfig + cfg.Addr = s.Addr() + logger := log.NewLogfmtLogger(os.Stderr) + reg := prometheus.NewRegistry() + _, err = NewRedisClientWithConfig(logger, "test1", cfg, reg) + testutil.Ok(t, err) + _, err = NewRedisClientWithConfig(logger, "test2", cfg, reg) + testutil.Ok(t, err) +}