Properly identify the agent in agentd session
@@ -92,7 +92,8 @@ func NewSession(cfg SessionConfig, conn transport.Transport, bus messaging.Messa
logger.WithFields(logrus.Fields{
"addr": cfg.AgentAddr,
- "id": cfg.AgentName,
+ "namespace": cfg.Namespace,
+ "agent": cfg.AgentName,
"subscriptions": cfg.Subscriptions,
}).Info("agent connected")
@@ -146,7 +147,7 @@ func (s *Session) recvPump() {
case transport.ConnectionError, transport.ClosedError:
logger.WithFields(logrus.Fields{
"addr": s.cfg.AgentAddr,
- "id": s.cfg.AgentName,
+ "agent": s.cfg.AgentName,
"recv error": err.Error(),
}).Warn("stopping session")
return
@@ -275,7 +276,10 @@ func (s *Session) Stop() {
close(s.checkChannel)
for _, sub := range s.cfg.Subscriptions {
ring := s.ringPool.Get(ringv2.Path(s.cfg.Namespace, sub))
- logger.Info("removing agent from ring")
+ logger.WithFields(logrus.Fields{
+ "namespace": s.cfg.Namespace,
+ "agent": s.cfg.AgentName,
+ }).Info("removing agent from ring")
if err := ring.Remove(s.ctx, s.cfg.AgentName); err != nil {
logger.WithError(err).Error("unable to remove agent from ring")
}
