code: func (m *AgentPool) reportStats() {
  	var logReport bool
  	if m.cfg.Clock.Now().Sub(m.lastReport) > defaults.ReportingPeriod {
  		m.lastReport = m.cfg.Clock.Now()
  		logReport = true
  	}
  
  	for key, agents := range m.agents {
  		m.Debugf("Outbound tunnel for %v connected to %v proxies.", key.tunnelID, len(agents))
  
  		countPerState := map[string]int{
  			agentStateConnecting:   0,
  			agentStateDiscovering:  0,
  			agentStateConnected:    0,
  			agentStateDiscovered:   0,
  			agentStateDisconnected: 0,
  		}
  		for _, a := range agents {
  			countPerState[a.getState()]++
  		}
  		for state, count := range countPerState {
  			gauge, err := trustedClustersStats.GetMetricWithLabelValues(key.tunnelID, state)
  			if err != nil {
  				m.Warningf("Failed to get gauge: %v.", err)
  				continue
  			}
  			gauge.Set(float64(count))
  		}
  		if logReport {
  			m.WithFields(log.Fields{"target": key.tunnelID, "stats": countPerState}).Info("Outbound tunnel stats.")
  		}
  	}
  }
docs: // reportStats submits report about agents state once in a while at info
  // level. Always logs more detailed information at debug level.