Skip to content

Commit

Permalink
rpc: log method when a server/server RPC call fails (#4548)
Browse files Browse the repository at this point in the history
Sometimes, we have lots of errors in cross calls between DCs (several hundreds / sec)
Enrich the log in order to help diagnose the root cause of issue.
  • Loading branch information
pierresouchay authored and hanshasselberg committed Jan 13, 2020
1 parent 27f49ee commit 3bf2e64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/consul/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,15 @@ func (s *Server) forwardDC(method, dc string, args interface{}, reply interface{
s.logger.Printf("[WARN] consul.rpc: RPC request to DC %q is currently failing as no server can be reached", dc)
return structs.ErrDCNotAvailable
}
s.logger.Printf("[WARN] consul.rpc: RPC request for unknown DC %q", dc)
s.logger.Printf("[WARN] consul.rpc: RPC request for DC %q, no path found (method: %s)", dc, method)
return structs.ErrNoDCPath
}

metrics.IncrCounterWithLabels([]string{"rpc", "cross-dc"}, 1,
[]metrics.Label{{Name: "datacenter", Value: dc}})
if err := s.connPool.RPC(dc, server.Addr, server.Version, method, server.UseTLS, args, reply); err != nil {
manager.NotifyFailedServer(server)
s.logger.Printf("[ERR] consul: RPC failed to server %s in DC %q: %v", server.Addr, dc, err)
s.logger.Printf("[ERR] consul: RPC failed to server %s in DC %q: %v (method: %s)", server.Addr, dc, err, method)
return err
}

Expand Down

0 comments on commit 3bf2e64

Please sign in to comment.