Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow compactor disablement #1850

Merged
merged 4 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ overrides:
* [ENHANCEMENT] Exit early from sharded search requests [#1742](https://github.com/grafana/tempo/pull/1742) (@electron0zero)
* [ENHANCEMENT] Upgrade prometheus/prometheus to `51a44e6657c3` [#1829](https://github.com/grafana/tempo/pull/1829) (@mapno)
* [ENHANCEMENT] Avoid running tempodb pool jobs with a cancelled context [#1852](https://github.com/grafana/tempo/pull/1852) (@zalegrala)
* [ENHANCEMENT] Add config flag to allow for compactor disablement for debug purposes [#1850](https://github.com/grafana/tempo/pull/1850) (@zalegrala)
* [CHANGE] Identify bloom that could not be retrieved from backend block [#1737](https://github.com/grafana/tempo/pull/1737) (@AlexDHoffer)
* [CHANGE] tempo: check configuration returns now a list of warnings [#1663](https://github.com/grafana/tempo/pull/1663) (@frzifus)
* [CHANGE] Make DNS address fully qualified to reduce DNS lookups in Kubernetes [#1687](https://github.com/grafana/tempo/pull/1687) (@electron0zero)
Expand Down
5 changes: 5 additions & 0 deletions docs/tempo/website/configuration/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ Compactors stream blocks from the storage backend, combine them and write them b
```yaml
compactor:

# Optional. Disables backend compaction. Default is false.
# Note: This should only be used in a non-prodution context for debugging purposes. This will allow blocks to say in the backend for further investigation if desired.
[disabled: <bool>]

zalegrala marked this conversation as resolved.
Show resolved Hide resolved
ring:

kvstore:
Expand Down Expand Up @@ -476,6 +480,7 @@ compactor:
# Optional. The time between compaction cycles. Default is 30s.
# Note: The default will be used if the value is set to 0.
[compaction_cycle: <duration>]

```

## Storage
Expand Down
6 changes: 4 additions & 2 deletions modules/compactor/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ func (c *Compactor) starting(ctx context.Context) (err error) {
}

func (c *Compactor) running(ctx context.Context) error {
level.Info(log.Logger).Log("msg", "enabling compaction")
c.store.EnableCompaction(&c.cfg.Compactor, c, c)
if !c.cfg.Disabled {
level.Info(log.Logger).Log("msg", "enabling compaction")
c.store.EnableCompaction(&c.cfg.Compactor, c, c)
}

if c.subservices != nil {
select {
Expand Down
2 changes: 2 additions & 0 deletions modules/compactor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

type Config struct {
Disabled bool `yaml:"disabled,omitempty"`
ShardingRing RingConfig `yaml:"ring,omitempty"`
Compactor tempodb.CompactorConfig `yaml:"compaction"`
OverrideRingKey string `yaml:"override_ring_key"`
Expand All @@ -37,6 +38,7 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)
f.IntVar(&cfg.Compactor.MaxCompactionObjects, util.PrefixConfig(prefix, "compaction.max-objects-per-block"), 6000000, "Maximum number of traces in a compacted block.")
f.Uint64Var(&cfg.Compactor.MaxBlockBytes, util.PrefixConfig(prefix, "compaction.max-block-bytes"), 100*1024*1024*1024 /* 100GB */, "Maximum size of a compacted block.")
f.DurationVar(&cfg.Compactor.MaxCompactionRange, util.PrefixConfig(prefix, "compaction.compaction-window"), time.Hour, "Maximum time window across which to compact blocks.")
f.BoolVar(&cfg.Disabled, util.PrefixConfig(prefix, "disabled"), false, "Disable compaction.")
cfg.OverrideRingKey = compactorRingKey
}

Expand Down