func (t *QueueManager) Append(s []tsdb.RefSample) bool {
	type enqueuable struct {
		ts  prompb.TimeSeries
		ref uint64
	}

	tempSamples := make([]enqueuable, 0, len(s))
	t.seriesMtx.Lock()
	for _, sample := range s {
		// If we have no labels for the series, due to relabelling or otherwise, don't send the sample.
		if _, ok := t.seriesLabels[sample.Ref]; !ok {
			t.droppedSamplesTotal.Inc()
			t.samplesDropped.incr(1)
			if _, ok := t.droppedSeries[sample.Ref]; !ok {
				level.Info(t.logger).Log("msg", "dropped sample for series that was not explicitly dropped via relabelling", "ref", sample.Ref)
			}
			continue
		}
		tempSamples = append(tempSamples, enqueuable{
			ts: prompb.TimeSeries{
				Labels: t.seriesLabels[sample.Ref],
				Samples: []prompb.Sample{
					prompb.Sample{
						Value:     float64(sample.V),
						Timestamp: sample.T,
					},
				},
			},
			ref: sample.Ref,
		})
	}
	t.seriesMtx.Unlock()

outer:
	for _, sample := range tempSamples {
		// This will only loop if the queues are being resharded.
		backoff := t.cfg.MinBackoff
		for {
			select {
			case <-t.quit:
				return false
			default:
			}

			if t.shards.enqueue(sample.ref, sample.ts) {
				continue outer
			}

			t.enqueueRetriesMetric.Inc()
			time.Sleep(time.Duration(backoff))
			backoff = backoff * 2
			if backoff > t.cfg.MaxBackoff {
				backoff = t.cfg.MaxBackoff
			}
		}
	}
	return true
}
func (t *QueueManager) Append(s []tsdb.RefSample) bool {
	type enqueuable struct {
		ts  prompb.TimeSeries
		ref uint64
	}

	tempSamples := make([]enqueuable, 0, len(s))
	t.seriesMtx.Lock()
	for _, sample := range s {
		
		if _, ok := t.seriesLabels[sample.Ref]; !ok {
			t.droppedSamplesTotal.Inc()
			t.samplesDropped.incr(1)
			if _, ok := t.droppedSeries[sample.Ref]; !ok {
				level.Info(t.logger).Log("msg", "dropped sample for series that was not explicitly dropped via relabelling", "ref", sample.Ref)
			}
			continue
		}
		tempSamples = append(tempSamples, enqueuable{
			ts: prompb.TimeSeries{
				Labels: t.seriesLabels[sample.Ref],
				Samples: []prompb.Sample{
					prompb.Sample{
						Value:     float64(sample.V),
						Timestamp: sample.T,
					},
				},
			},
			ref: sample.Ref,
		})
	}
	t.seriesMtx.Unlock()

outer:
	for _, sample := range tempSamples {
		
		backoff := t.cfg.MinBackoff
		for {
			select {
			case <-t.quit:
				return false
			default:
			}

			if t.shards.enqueue(sample.ref, sample.ts) {
				continue outer
			}

			t.enqueueRetriesMetric.Inc()
			time.Sleep(time.Duration(backoff))
			backoff = backoff * 2
			if backoff > t.cfg.MaxBackoff {
				backoff = t.cfg.MaxBackoff
			}
		}
	}
	return true
}
func ( t * QueueManager ) Append ( s [ ] tsdb . RefSample ) bool { type enqueuable struct { ts prompb . TimeSeries ref uint64 } tempSamples := make ( [ ] enqueuable , 0 , len ( s ) ) t . seriesMtx . Lock ( ) for _ , sample := range s { // If we have no labels for the series, due to relabelling or otherwise, don't send the sample. if _ , ok := t . seriesLabels [ sample . Ref ] ; ! ok { t . droppedSamplesTotal . Inc ( ) t . samplesDropped . incr ( 1 ) if _ , ok := t . droppedSeries [ sample . Ref ] ; ! ok { level . Info ( t . logger ) . Log ( " " , " " , " " , sample . Ref ) } continue } tempSamples = append ( tempSamples , enqueuable { ts : prompb . TimeSeries { Labels : t . seriesLabels [ sample . Ref ] , Samples : [ ] prompb . Sample { prompb . Sample { Value : float64 ( sample . V ) , Timestamp : sample . T , } , } , } , ref : sample . Ref , } ) } t . seriesMtx . Unlock ( ) outer : for _ , sample := range tempSamples { // This will only loop if the queues are being resharded. backoff := t . cfg . MinBackoff for { select { case <- t . quit : return false default : } if t . shards . enqueue ( sample . ref , sample . ts ) { continue outer } t . enqueueRetriesMetric . Inc ( ) time . Sleep ( time . Duration ( backoff ) ) backoff = backoff * 2 if backoff > t . cfg . MaxBackoff { backoff = t . cfg . MaxBackoff } } } return true }
// Append queues a sample to be sent to the remote storage. Blocks until all samples are
// enqueued on their shards or a shutdown signal is received.
Append queues a sample to be sent to the remote storage . Blocks until all samples are enqueued on their shards or a shutdown signal is received .