fix: improves coordination logging (#14556)

This commit is contained in:
Spike Curtis
2024-09-04 15:10:43 +04:00
committed by GitHub
parent 2e6dbd18b3
commit 7b39f6b0d4
3 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -65,7 +65,7 @@ func newConnIO(coordContext context.Context,
coordCtx: coordContext,
peerCtx: peerCtx,
cancel: cancel,
logger: logger.With(slog.F("name", name)),
logger: logger.With(slog.F("name", name), slog.F("peer_id", id)),
requests: requests,
responses: responses,
bindings: bindings,
@@ -135,6 +135,7 @@ func (c *connIO) handleRequest(req *proto.CoordinateRequest) error {
c.logger.Debug(c.peerCtx, "got request")
err := c.auth.Authorize(req)
if err != nil {
c.logger.Warn(c.peerCtx, "unauthorized request", slog.Error(err))
return xerrors.Errorf("authorize request: %w", err)
}
+1
View File
@@ -239,6 +239,7 @@ func (c *configMaps) setTunnelDestination(id uuid.UUID) {
lc = &peerLifecycle{
peerID: id,
}
c.logger.Debug(context.Background(), "setting peer tunnel destination", slog.F("peer_id", id))
c.peers[id] = lc
}
lc.isDestination = true
+3
View File
@@ -162,12 +162,14 @@ func (c *remoteCoordination) respLoop() {
for {
resp, err := c.protocol.Recv()
if err != nil {
c.logger.Debug(context.Background(), "failed to read from protocol", slog.Error(err))
c.sendErr(xerrors.Errorf("read: %w", err))
return
}
err = c.coordinatee.UpdatePeers(resp.GetPeerUpdates())
if err != nil {
c.logger.Debug(context.Background(), "failed to update peers", slog.Error(err))
c.sendErr(xerrors.Errorf("update peers: %w", err))
return
}
@@ -191,6 +193,7 @@ func (c *remoteCoordination) respLoop() {
ReadyForHandshake: rfh,
})
if err != nil {
c.logger.Debug(context.Background(), "failed to send ready for handshake", slog.Error(err))
c.sendErr(xerrors.Errorf("send: %w", err))
return
}