func (w *StatsWriter) Run() {
	t := time.NewTicker(5 * time.Second)
	defer t.Stop()
	defer close(w.stop)
	for {
		select {
		case stats := <-w.in:
			w.addStats(stats)
			if !w.syncMode {
				w.sendPayloads()
			}
		case notify := <-w.flushChan:
			w.sendPayloads()
			notify <- struct{}{}
		case <-t.C:
			w.report()
		case <-w.stop:
			return
		}
	}
}
// Run starts the StatsWriter, making it ready to receive stats and report metrics.
Run starts the StatsWriter, making it ready to receive stats and report metrics.
// Run starts the StatsWriter making it ready to receive stats and report metrics .
func (w *StatsWriter) Run() {
	t := time.NewTicker(5 * time.Second)
	defer t.Stop()
	defer close(w.stop)
	for {
		select {
		case stats := <-w.in:
			w.addStats(stats)
			if !w.syncMode {
				w.sendPayloads()
			}
		case notify := <-w.flushChan:
			w.sendPayloads()
			notify <- struct{}{}
		case <-t.C:
			w.report()
		case <-w.stop:
			return
		}
	}
}
func ( w * StatsWriter ) Run ( ) { t := time . NewTicker ( 5 * time . Second ) defer t . Stop ( ) defer close ( w . stop ) for { select { case stats := <- w . in : w . addStats ( stats ) if ! w . syncMode { w . sendPayloads ( ) } case notify := <- w . flushChan : w . sendPayloads ( ) notify <- struct { } { } case <- t . C : w . report ( ) case <- w . stop : return } } }
Run starts the StatsWriter, making it ready to receive stats and report metrics.
Run starts the StatsWriter making it ready to receive stats and report metrics .