Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging what really caused lookup failure #450

Merged
merged 2 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pulsar/internal/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (c *connection) waitUntilReady() error {
defer c.Unlock()

for c.state != connectionReady {
c.log.Debug("Wait until connection is ready. State: ", c.state)
c.log.Debugf("Wait until connection is ready. State: %s", connectionState(c.state))
if c.state == connectionClosed {
return errors.New("connection error")
}
Expand Down
13 changes: 6 additions & 7 deletions pulsar/internal/lookup_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package internal

import (
"errors"
"fmt"
"net/url"

"github.com/gogo/protobuf/proto"
Expand Down Expand Up @@ -140,12 +139,12 @@ func (ls *lookupService) Lookup(topic string) (*LookupResult, error) {
}, nil

case pb.CommandLookupTopicResponse_Failed:
errorMsg := ""
if lr.Error != nil {
errorMsg = lr.Error.String()
}
ls.log.Warnf("Failed to lookup topic: %s, error msg: %s", topic, errorMsg)
return nil, fmt.Errorf("failed to lookup topic: %s", errorMsg)
ls.log.WithFields(log.Fields{
"topic": topic,
"error": lr.GetError(),
"message": lr.GetMessage(),
}).Warn("Failed to lookup topic")
return nil, errors.New(lr.GetError().String())
}
}

Expand Down