diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index e9b76e9f26905..0bd91a5ec9afd 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -1029,13 +1029,15 @@ func (t *Loki) initQueryFrontend() (_ services.Service, err error) { } func (t *Loki) initRulerStorage() (_ services.Service, err error) { + logger := log.With(util_log.Logger, "component", "ruler-storage") + // if the ruler is not configured and we're in single binary then let's just log an error and continue. // unfortunately there is no way to generate a "default" config and compare default against actual // to determine if it's unconfigured. the following check, however, correctly tests this. // Single binary integration tests will break if this ever drifts legacyReadMode := t.Cfg.LegacyReadTarget && t.Cfg.isModuleEnabled(Read) if (t.Cfg.isModuleEnabled(All) || legacyReadMode || t.Cfg.isModuleEnabled(Backend)) && t.Cfg.Ruler.StoreConfig.IsDefaults() && t.Cfg.RulerStorage.IsDefaults() { - level.Info(util_log.Logger).Log("msg", "Ruler storage is not configured; ruler will not be started.") + level.Info(logger).Log("msg", "Ruler storage is not configured; ruler will not be started.") return } @@ -1048,9 +1050,9 @@ func (t *Loki) initRulerStorage() (_ services.Service, err error) { } if !t.Cfg.Ruler.StoreConfig.IsDefaults() { - t.RulerStorage, err = base_ruler.NewLegacyRuleStore(t.Cfg.Ruler.StoreConfig, t.Cfg.StorageConfig.Hedging, t.clientMetrics, ruler.GroupLoader{}, util_log.Logger) + t.RulerStorage, err = base_ruler.NewLegacyRuleStore(t.Cfg.Ruler.StoreConfig, t.Cfg.StorageConfig.Hedging, t.clientMetrics, ruler.GroupLoader{}, logger) } else { - t.RulerStorage, err = base_ruler.NewRuleStore(context.Background(), t.Cfg.RulerStorage, nil, ruler.GroupLoader{}, util_log.Logger, prometheus.DefaultRegisterer) + t.RulerStorage, err = base_ruler.NewRuleStore(context.Background(), t.Cfg.RulerStorage, nil, ruler.GroupLoader{}, logger, prometheus.DefaultRegisterer) } return