Skip to content

Commit

Permalink
validate config when starting distributor
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriltovena committed Oct 4, 2024
1 parent 2ba002d commit 74ace41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ func (t *Loki) initTenantConfigs() (_ services.Service, err error) {
func (t *Loki) initDistributor() (services.Service, error) {
t.Cfg.Distributor.KafkaConfig = t.Cfg.KafkaConfig

if t.Cfg.Distributor.KafkaEnabled && !t.Cfg.Ingester.KafkaIngestion.Enabled {
return nil, errors.New("kafka is enabled in distributor but not in ingester")
}

var err error
logger := log.With(util_log.Logger, "component", "distributor")
t.distributor, err = distributor.New(
Expand Down Expand Up @@ -1754,7 +1758,7 @@ func (t *Loki) initAnalytics() (services.Service, error) {

// The Ingest Partition Ring is responsible for watching the available ingesters and assigning partitions to incoming requests.
func (t *Loki) initPartitionRing() (services.Service, error) {
if !t.Cfg.Ingester.KafkaIngestion.Enabled && !t.Cfg.Distributor.KafkaEnabled {
if !t.Cfg.Ingester.KafkaIngestion.Enabled {
return nil, nil
}

Expand Down

0 comments on commit 74ace41

Please sign in to comment.