code: func New(metricSender MetricSender, batchDuration time.Duration) *MetricBatcher {
  	mb := &MetricBatcher{
  		batchTicker:  time.NewTicker(batchDuration),
  		metricSender: metricSender,
  		closed:       false,
  		closedChan:   make(chan struct{}),
  	}
  
  	go func() {
  		for {
  			select {
  			case <-mb.batchTicker.C:
  				mb.flush(mb.resetAndReturnMetrics())
  			case <-mb.closedChan:
  				mb.batchTicker.Stop()
  				return
  			}
  		}
  	}()
  
  	return mb
  }
docs: // New instantiates a running MetricBatcher. Eventswill be emitted once per batchDuration. All
  // updates to a given counter name will be combined into a single event and sent to metricSender.