code: func NewManager(o *Options, logger log.Logger) *Manager {
  	ctx, cancel := context.WithCancel(context.Background())
  
  	if o.Do == nil {
  		o.Do = do
  	}
  	if logger == nil {
  		logger = log.NewNopLogger()
  	}
  
  	n := &Manager{
  		queue:  make([]*Alert, 0, o.QueueCapacity),
  		ctx:    ctx,
  		cancel: cancel,
  		more:   make(chan struct{}, 1),
  		opts:   o,
  		logger: logger,
  	}
  
  	queueLenFunc := func() float64 { return float64(n.queueLen()) }
  	alertmanagersDiscoveredFunc := func() float64 { return float64(len(n.Alertmanagers())) }
  
  	n.metrics = newAlertMetrics(
  		o.Registerer,
  		o.QueueCapacity,
  		queueLenFunc,
  		alertmanagersDiscoveredFunc,
  	)
  
  	return n
  }
docs: // NewManager is the manager constructor.