code: func (a *Autopilot) updateServerHealth(health *ServerHealth,
  	server *ServerInfo, stats *ServerStats,
  	autopilotConf *Config, targetLastIndex uint64) error {
  
  	health.LastTerm = stats.LastTerm
  	health.LastIndex = stats.LastIndex
  
  	if stats.LastContact != "never" {
  		var err error
  		health.LastContact, err = time.ParseDuration(stats.LastContact)
  		if err != nil {
  			return fmt.Errorf("error parsing last_contact duration: %s", err)
  		}
  	}
  
  	raftNode := a.delegate.Raft()
  	lastTerm, err := strconv.ParseUint(raftNode.Stats()["last_log_term"], 10, 64)
  	if err != nil {
  		return fmt.Errorf("error parsing last_log_term: %s", err)
  	}
  	health.Healthy = health.IsHealthy(lastTerm, targetLastIndex, autopilotConf)
  
  	// If this is a new server or the health changed, reset StableSince
  	lastHealth := a.GetServerHealth(server.ID)
  	if lastHealth == nil || lastHealth.Healthy != health.Healthy {
  		health.StableSince = time.Now()
  	} else {
  		health.StableSince = lastHealth.StableSince
  	}
  
  	return nil
  }
docs: // updateServerHealth computes the resulting health of the server based on its
  // fetched stats and the state of the leader.