func()

in pkg/server/server.go [133:153]


func (s *Server) tick(ctx context.Context, startTime time.Time) {
	s.tickStatusMux.Lock()
	s.tickLastStart = startTime
	s.tickStatusMux.Unlock()

	ctx, cancelTimeout := context.WithTimeout(ctx, s.Config.ReportInterval)
	defer cancelTimeout()

	klog.V(1).Infof("[%s] Scraping metrics starts\n", startTime.Format(time.RFC3339))
	if common.ModeCluster == s.Config.Mode {
		scheduler.RecordClusterMetrics(ctx, s.cr, s.cw.GetNodes(), s.cw.GetDaemonSets(), s.cw.GetDeployments())
		if s.Config.ClusterProbes {
			scheduler.RecordClusterProbeMetrics(ctx, s.clientSet, s.pr, probe.ClusterProbes())
		}
	} else {
		scheduler.RecordNodeMetrics(ctx, s.nr, s.Config, s.nw.GetNodes(), s.nw.GetPods(), probe.NodeProbes())
	}

	collectTime := time.Since(startTime)
	klog.V(1).Infof("[%s] Scraping cycle ends. Duration(seconds): %f\n", time.Now().Format(time.RFC3339), float64(collectTime)/float64(time.Second))
}