Skip to content

Commit

Permalink
Only add consume config for appropriate scrapeMode
Browse files Browse the repository at this point in the history
  • Loading branch information
weeco committed Nov 4, 2021
1 parent c1e922e commit fcd8c0c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions minion/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ func NewService(cfg Config, logger *zap.Logger, kafkaSvc *kafka.Service, metrics
minionHooks := newMinionClientHooks(logger.Named("kafka_hooks"), metricsNamespace)
kgoOpts := []kgo.Opt{
kgo.WithHooks(minionHooks),
kgo.ConsumeTopics("__consumer_offsets"),
kgo.ConsumeResetOffset(kgo.NewOffset().AtStart()),
}
if cfg.ConsumerGroups.ScrapeMode == ConsumerGroupScrapeModeOffsetsTopic {
kgoOpts = append(kgoOpts,
kgo.ConsumeResetOffset(kgo.NewOffset().AtStart()),
kgo.ConsumeTopics("__consumer_offsets"))
}

client, err := kafkaSvc.CreateAndTestClient(ctx, logger, kgoOpts)
Expand Down

0 comments on commit fcd8c0c

Please sign in to comment.