Skip to content

Commit

Permalink
add compactor working dir to auto-configured file paths (#4413)
Browse files Browse the repository at this point in the history
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
  • Loading branch information
trevorwhitney authored Oct 6, 2021
1 parent eedcabf commit bdc07d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/loki/config_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions pkg/loki/config_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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)
})
})

Expand Down

0 comments on commit bdc07d1

Please sign in to comment.