code: func (p *Producer) Stop() {
  	p.Logger.WithField("backlog", len(p.records)).Info("stopping producer")
  
  	// drain
  	p.done <- struct{}{}
  	close(p.records)
  
  	// wait
  	<-p.done
  
  	p.Logger.Info("stopped producer")
  }
docs: // Stop the producer. Flushes any in-flight data.