Skip to content

Commit

Permalink
Fix cluster-wide Kafka client bug
Browse files Browse the repository at this point in the history
Signed-off-by: chrismark <[email protected]>
  • Loading branch information
ChrsMark committed Nov 29, 2019
1 parent 8859ead commit 4f0b4f9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions metricbeat/module/kafka/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ func (b *Broker) Connect() error {
return errors.Wrap(err, "broker.Open failed")
}

c, err := getClusterWideClient(b.Addr(), b.cfg)
if err != nil {
closeBroker(b.broker)
return fmt.Errorf("Could not get cluster client for advertised broker with address %v", b.Addr())
}
b.client = c

if b.id != noID || !b.matchID {
return nil
}
Expand All @@ -138,12 +145,6 @@ func (b *Broker) Connect() error {
b.id = other.ID()
b.advertisedAddr = other.Addr()

c, err := getClusterWideClient(b.Addr(), b.cfg)
if err != nil {
closeBroker(b.broker)
return fmt.Errorf("Could not get cluster client for advertised broker with address %v", b.Addr())
}
b.client = c
return nil
}

Expand Down

0 comments on commit 4f0b4f9

Please sign in to comment.