Skip to content

Commit

Permalink
Append ruler labels as external labels when using stateless ruler mode (
Browse files Browse the repository at this point in the history
#5205)

* append ruler labels as external labels when using stateless ruler mode

Signed-off-by: Ben Ye <ben.ye@bytedance.com>

* update changelog

Signed-off-by: Ben Ye <ben.ye@bytedance.com>
  • Loading branch information
Ben Ye committed Mar 3, 2022
1 parent 34e6527 commit 4af52f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion cmd/thanos/rule.go
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/rule_test.go
Expand Up @@ -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",
},
})
Expand Down

0 comments on commit 4af52f2

Please sign in to comment.