func (w *watcher) report() *watcherReport {
	if len(w.instances) == 0 {
		return nil
	}

	totalThreads := 0
	failedPorts := []string{}

	for p := range w.instances {
		metrics, err := getReport(p)
		if err != nil {
			w.log.Error(errors.Wrapf(err, "failed to getReport for %s", p))
			failedPorts = append(failedPorts, p)
		} else {
			w.instances[p].metrics = metrics
			totalThreads += metrics.Scheduler.TotalThreadCount
		}
	}

	report := &watcherReport{
		instCount:    len(w.instances) - len(failedPorts),
		totalThreads: totalThreads,
		failedPorts:  failedPorts,
	}

	return report
}
// report fetches a metrics report from each watched instance and returns a summary
report fetches a metrics report from each watched instance and returns a summary
// report fetches a metrics report from each watched instance and returns a summary
func (w *watcher) report() *watcherReport {
	if len(w.instances) == 0 {
		return nil
	}
	totalThreads := 0
	failedPorts := []string{}
	for p := range w.instances {
		metrics, err := getReport(p)
		if err != nil {
			w.log.Error(errors.Wrapf(err, "failed to getReport for %s", p))
			failedPorts = append(failedPorts, p)
		} else {
			w.instances[p].metrics = metrics
			totalThreads += metrics.Scheduler.TotalThreadCount
		}
	}
	report := &watcherReport{
		instCount:    len(w.instances) - len(failedPorts),
		totalThreads: totalThreads,
		failedPorts:  failedPorts,
	}
	return report
}
func ( w * watcher ) report ( ) * watcherReport { if len ( w . instances ) == 0 { return nil } totalThreads := 0 failedPorts := [ ] string { } for p := range w . instances { metrics , err := getReport ( p ) if err != nil { w . log . Error ( errors . Wrapf ( err , " " , p ) ) failedPorts = append ( failedPorts , p ) } else { w . instances [ p ] . metrics = metrics totalThreads += metrics . Scheduler . TotalThreadCount } } report := & watcherReport { instCount : len ( w . instances ) - len ( failedPorts ) , totalThreads : totalThreads , failedPorts : failedPorts , } return report }
report fetches a metrics report from each watched instance and returns a summary
report fetches a metrics report from each watched instance and returns a summary