func (a *Agent) gatherer(
	shutdown chan struct{},
	input *models.RunningInput,
	interval time.Duration,
	metricC chan telegraf.Metric,
) {
	defer panicRecover(input)

	GatherTime := selfstat.RegisterTiming("gather",
		"gather_time_ns",
		map[string]string{"input": input.Config.Name},
	)

	acc := NewAccumulator(input, metricC)
	acc.SetPrecision(a.Config.Agent.Precision.Duration,
		a.Config.Agent.Interval.Duration)

	ticker := time.NewTicker(interval)
	defer ticker.Stop()

	for {
		internal.RandomSleep(a.Config.Agent.CollectionJitter.Duration, shutdown)

		start := time.Now()
		gatherWithTimeout(shutdown, input, acc, interval)
		elapsed := time.Since(start)

		GatherTime.Incr(elapsed.Nanoseconds())

		select {
		case <-shutdown:
			return
		case <-ticker.C:
			continue
		}
	}
}
// gatherer runs the inputs that have been configured with their own
// reporting interval.
gatherer runs the inputs that have been configured with their own
reporting interval.
// gatherer runs the inputs that have been configured with their own // reporting interval .
func (a *Agent) gatherer(
	shutdown chan struct{},
	input *models.RunningInput,
	interval time.Duration,
	metricC chan telegraf.Metric,
) {
	defer panicRecover(input)
	GatherTime := selfstat.RegisterTiming("gather",
		"gather_time_ns",
		map[string]string{"input": input.Config.Name},
	)
	acc := NewAccumulator(input, metricC)
	acc.SetPrecision(a.Config.Agent.Precision.Duration,
		a.Config.Agent.Interval.Duration)
	ticker := time.NewTicker(interval)
	defer ticker.Stop()
	for {
		internal.RandomSleep(a.Config.Agent.CollectionJitter.Duration, shutdown)
		start := time.Now()
		gatherWithTimeout(shutdown, input, acc, interval)
		elapsed := time.Since(start)
		GatherTime.Incr(elapsed.Nanoseconds())
		select {
		case <-shutdown:
			return
		case <-ticker.C:
			continue
		}
	}
}
func ( a * Agent ) gatherer ( shutdown chan struct { } , input * models . RunningInput , interval time . Duration , metricC chan telegraf . Metric , ) { defer panicRecover ( input ) GatherTime := selfstat . RegisterTiming ( " " , " " , map [ string ] string { " " : input . Config . Name } , ) acc := NewAccumulator ( input , metricC ) acc . SetPrecision ( a . Config . Agent . Precision . Duration , a . Config . Agent . Interval . Duration ) ticker := time . NewTicker ( interval ) defer ticker . Stop ( ) for { internal . RandomSleep ( a . Config . Agent . CollectionJitter . Duration , shutdown ) start := time . Now ( ) gatherWithTimeout ( shutdown , input , acc , interval ) elapsed := time . Since ( start ) GatherTime . Incr ( elapsed . Nanoseconds ( ) ) select { case <- shutdown : return case <- ticker . C : continue } } }
gatherer runs the inputs that have been configured with their own
reporting interval.
gatherer runs the inputs that have been configured with their own reporting interval .