MCPcopy
hub / github.com/grafana/tempo / ValidateConfig

Function ValidateConfig

modules/backendscheduler/config.go:37–60  ·  view source on GitHub ↗
(cfg *Config)

Source from the content-addressed store, hash-verified

35}
36
37func ValidateConfig(cfg *Config) error {
38 if err := work.ValidateConfig(&cfg.Work); err != nil {
39 return err
40 }
41
42 if err := provider.ValidateConfig(&cfg.ProviderConfig); err != nil {
43 return err
44 }
45
46 // Validate the measurement interval is twice the speed of the prune interval
47 // so that the when newBlockSelector is called it has enough time to delete
48 // the temporary entry and know that it has been persisted to the work cache.
49 // If the prune age is too short, work could get deleted before the
50 // newBlockSelector is able to delete the temporary entry.
51 if cfg.ProviderConfig.Compaction.MeasureInterval > cfg.Work.PruneAge/2 {
52 return fmt.Errorf("provider.compaction.measure_interval must be no more than half of work.prune_age; tenant measurement should happen at least twice as often as the work prune, got %s and %s", cfg.ProviderConfig.Compaction.MeasureInterval, cfg.Work.PruneAge/2)
53 }
54
55 if cfg.ProviderConfig.Redaction.RescanDelay > 0 && cfg.Work.PruneAge <= cfg.ProviderConfig.Redaction.RescanDelay {
56 return fmt.Errorf("work.prune_age must be greater than provider.redaction.rescan_delay so that compaction jobs are still in memory when a rescan fires; got prune_age=%s rescan_delay=%s", cfg.Work.PruneAge, cfg.ProviderConfig.Redaction.RescanDelay)
57 }
58
59 return nil
60}

Callers 1

NewFunction · 0.70

Calls 2

ValidateConfigFunction · 0.92
ValidateConfigFunction · 0.92

Tested by

no test coverage detected