We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd5fa81 commit c7bf245Copy full SHA for c7bf245
kafka/consumer.go
@@ -393,7 +393,10 @@ func (c *Consumer) fetch(ctx context.Context) error {
393
fetches.EachError(func(t string, p int32, err error) {
394
topicName := strings.TrimPrefix(t, c.consumer.topicPrefix)
395
logger := c.cfg.Logger
396
- if c.cfg.TopicLogFieldFunc != nil {
+ // franz-go can inject fake fetches in case of errors.
397
+ // the fake fetch can have an empty topic so we need to
398
+ // account for that
399
+ if c.cfg.TopicLogFieldFunc != nil && topicName != "" {
400
logger = logger.With(c.cfg.TopicLogFieldFunc(topicName))
401
}
402
0 commit comments