diff --git a/CHANGELOG.md b/CHANGELOG.md index 848819051f..0bd063c59e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Fixed ### Changed +- [#5205](https://github.com/thanos-io/thanos/pull/5205) Rule: Add ruler labels as external labels in stateless ruler mode. ### Removed diff --git a/cmd/thanos/rule.go b/cmd/thanos/rule.go index dd9256c95e..47414f495f 100644 --- a/cmd/thanos/rule.go +++ b/cmd/thanos/rule.go @@ -363,7 +363,9 @@ func runRule( return 0, nil }, walDir, 1*time.Minute, nil) if err := remoteStore.ApplyConfig(&config.Config{ - GlobalConfig: config.DefaultGlobalConfig, + GlobalConfig: config.GlobalConfig{ + ExternalLabels: labelsTSDBToProm(conf.lset), + }, RemoteWriteConfigs: rwCfg.RemoteWriteConfigs, }); err != nil { return errors.Wrap(err, "applying config to remote storage") diff --git a/test/e2e/rule_test.go b/test/e2e/rule_test.go index a256e315ae..f4e1f6f2c0 100644 --- a/test/e2e/rule_test.go +++ b/test/e2e/rule_test.go @@ -539,12 +539,14 @@ func TestRule_CanRemoteWriteData(t *testing.T) { "__name__": "test_absent_metric", "job": "thanos-receive", "receive": "1", + "replica": "1", "tenant_id": "default-tenant", }, { "__name__": "test_absent_metric", "job": "thanos-receive", "receive": "2", + "replica": "1", "tenant_id": "default-tenant", }, })