Skip to content

Commit

Permalink
Make server logs less frequent and more informative.
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Aug 17, 2021
1 parent d82fb9b commit 984241d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *Server) nextRequest() (func() error, error) {
ch := s.ch // capture

next := s.inq.Remove(s.inq.Front()).(jmessages)
s.log("Dequeued request batch of length %d", len(next))
s.log("Dequeued request batch of length %d (qlen=%d)", len(next), s.inq.Len())

// Construct a dispatcher to run the handlers outside the lock.
return s.dispatch(next, ch), nil
Expand Down Expand Up @@ -263,7 +263,6 @@ func (s *Server) deliver(rsps jmessages, ch channel.Sender, elapsed time.Duratio
func (s *Server) checkAndAssign(next jmessages) tasks {
var ts tasks
for _, req := range next {
s.log("Checking request for %q: %s", req.M, string(req.P))
fid := fixID(req.ID)
t := &task{
hreq: &Request{id: fid, method: req.M, params: req.P},
Expand Down Expand Up @@ -295,7 +294,7 @@ func (s *Server) checkAndAssign(next jmessages) tasks {
}

if t.err != nil {
s.log("Task error: %v", t.err)
s.log("Request check error for %q (params %q): %v", req.M, string(req.P), t.err)
s.metrics.Count("rpc.errors", 1)
}
ts = append(ts, t)
Expand Down Expand Up @@ -587,7 +586,7 @@ func (s *Server) read(ch channel.Receiver) {
} else if len(in) == 0 {
s.pushError(Errorf(code.InvalidRequest, "empty request batch"))
} else {
s.log("Received request batch of size %d", len(in))
s.log("Received request batch of size %d (qlen=%d)", len(in), s.inq.Len())
s.inq.PushBack(in)
s.work.Broadcast()
}
Expand Down

0 comments on commit 984241d

Please sign in to comment.