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
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
  • Loading branch information
Ben Ye committed Mar 3, 2022
1 parent 34e6527 commit e7e8219
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/thanos/rule.go
Expand Up @@ -363,7 +363,12 @@ func runRule(
return 0, nil
}, walDir, 1*time.Minute, nil)
if err := remoteStore.ApplyConfig(&config.Config{
GlobalConfig: config.DefaultGlobalConfig,
GlobalConfig: config.GlobalConfig{
ScrapeInterval: model.Duration(1 * time.Minute),
ScrapeTimeout: model.Duration(10 * time.Second),
EvaluationInterval: model.Duration(1 * time.Minute),
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 e7e8219

Please sign in to comment.