code: func NewQueueManager(logger log.Logger, walDir string, samplesIn *ewmaRate, cfg config.QueueConfig, externalLabels labels.Labels, relabelConfigs []*relabel.Config, client StorageClient, flushDeadline time.Duration) *QueueManager {
  	if logger == nil {
  		logger = log.NewNopLogger()
  	}
  
  	name := client.Name()
  	logger = log.With(logger, "queue", name)
  	t := &QueueManager{
  		logger:         logger,
  		flushDeadline:  flushDeadline,
  		cfg:            cfg,
  		externalLabels: externalLabels,
  		relabelConfigs: relabelConfigs,
  		client:         client,
  
  		seriesLabels:         make(map[uint64][]prompb.Label),
  		seriesSegmentIndexes: make(map[uint64]int),
  		droppedSeries:        make(map[uint64]struct{}),
  
  		numShards:   cfg.MinShards,
  		reshardChan: make(chan int),
  		quit:        make(chan struct{}),
  
  		samplesIn:          samplesIn,
  		samplesDropped:     newEWMARate(ewmaWeight, shardUpdateDuration),
  		samplesOut:         newEWMARate(ewmaWeight, shardUpdateDuration),
  		samplesOutDuration: newEWMARate(ewmaWeight, shardUpdateDuration),
  	}
  
  	t.watcher = NewWALWatcher(logger, name, t, walDir)
  	t.shards = t.newShards()
  
  	return t
  }
docs: // NewQueueManager builds a new QueueManager.