From bdc07d1e9fa9036c15aab98adf4b4b07de47bf4d Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Wed, 6 Oct 2021 14:43:20 -0600 Subject: [PATCH] add compactor working dir to auto-configured file paths (#4413) Signed-off-by: Trevor Whitney --- pkg/loki/config_wrapper.go | 4 ++++ pkg/loki/config_wrapper_test.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/pkg/loki/config_wrapper.go b/pkg/loki/config_wrapper.go index 455f791de803..76b8e248023e 100644 --- a/pkg/loki/config_wrapper.go +++ b/pkg/loki/config_wrapper.go @@ -69,6 +69,10 @@ func (c *ConfigWrapper) ApplyDynamicConfig() cfg.Source { if r.Ingester.WAL.Dir == defaults.Ingester.WAL.Dir { r.Ingester.WAL.Dir = fmt.Sprintf("%s/wal", r.Common.PathPrefix) } + + if r.CompactorConfig.WorkingDirectory == defaults.CompactorConfig.WorkingDirectory { + r.CompactorConfig.WorkingDirectory = fmt.Sprintf("%s/compactor", r.Common.PathPrefix) + } } if len(r.MemberlistKV.JoinMembers) > 0 { diff --git a/pkg/loki/config_wrapper_test.go b/pkg/loki/config_wrapper_test.go index 831a641fd9a9..571a47043d56 100644 --- a/pkg/loki/config_wrapper_test.go +++ b/pkg/loki/config_wrapper_test.go @@ -60,6 +60,7 @@ common: assert.EqualValues(t, "/opt/loki/rules", config.Ruler.RulePath) assert.EqualValues(t, "/opt/loki/wal", config.Ingester.WAL.Dir) + assert.EqualValues(t, "/opt/loki/compactor", config.CompactorConfig.WorkingDirectory) }) t.Run("does not rewrite custom (non-default) paths passed via config file", func(t *testing.T) { @@ -72,6 +73,7 @@ ruler: assert.EqualValues(t, "/etc/ruler/rules", config.Ruler.RulePath) assert.EqualValues(t, "/opt/loki/wal", config.Ingester.WAL.Dir) + assert.EqualValues(t, "/opt/loki/compactor", config.CompactorConfig.WorkingDirectory) }) t.Run("does not rewrite custom (non-default) paths passed via the command line", func(t *testing.T) { @@ -82,6 +84,7 @@ common: assert.EqualValues(t, "/etc/ruler/rules", config.Ruler.RulePath) assert.EqualValues(t, "/opt/loki/wal", config.Ingester.WAL.Dir) + assert.EqualValues(t, "/opt/loki/compactor", config.CompactorConfig.WorkingDirectory) }) })