storage/remote/queue_manager.go
func (t *QueueManager) StoreSeries(series []tsdb.RefSeries, index int) {
	// Lock before any calls to labelsToLabels proto, as that's where string interning is done.
	t.seriesMtx.Lock()
	defer t.seriesMtx.Unlock()

	temp := make(map[uint64][]prompb.Label, len(series))
	for _, s := range series {
		ls := processExternalLabels(s.Labels, t.externalLabels)
		rl := relabel.Process(ls, t.relabelConfigs...)
		if len(rl) == 0 {
			t.droppedSeries[s.Ref] = struct{}{}
			continue
		}
		temp[s.Ref] = labelsToLabelsProto(rl)
	}

	for ref, labels := range temp {
		t.seriesSegmentIndexes[ref] = index

		// We should not ever be replacing a series labels in the map, but just
		// in case we do we need to ensure we do not leak the replaced interned
		// strings.
		if orig, ok := t.seriesLabels[ref]; ok {
			release(orig)
		}
		t.seriesLabels[ref] = labels
	}
}
func (t *QueueManager) StoreSeries(series []tsdb.RefSeries, index int) {
	// Lock before any calls to labelsToLabels proto, as that's where string interning is done.
	t.seriesMtx.Lock()
	defer t.seriesMtx.Unlock()

	temp := make(map[uint64][]prompb.Label, len(series))
	for _, s := range series {
		ls := processExternalLabels(s.Labels, t.externalLabels)
		rl := relabel.Process(ls, t.relabelConfigs...)
		if len(rl) == 0 {
			t.droppedSeries[s.Ref] = struct{}{}
			continue
		}
		temp[s.Ref] = labelsToLabelsProto(rl)
	}

	for ref, labels := range temp {
		t.seriesSegmentIndexes[ref] = index

		// We should not ever be replacing a series labels in the map, but just
		// in case we do we need to ensure we do not leak the replaced interned
		// strings.
		if orig, ok := t.seriesLabels[ref]; ok {
			release(orig)
		}
		t.seriesLabels[ref] = labels
	}
}
func ( t * QueueManager ) StoreSeries ( series [ ] tsdb . RefSeries , index int ) { // Lock before any calls to labelsToLabels proto, as that's where string interning is done. t . seriesMtx . Lock ( ) defer t . seriesMtx . Unlock ( ) temp := make ( map [ uint64 ] [ ] prompb . Label , len ( series ) ) for _ , s := range series { ls := processExternalLabels ( s . Labels , t . externalLabels ) rl := relabel . Process ( ls , t . relabelConfigs ... ) if len ( rl ) == 0 { t . droppedSeries [ s . Ref ] = struct { } { } continue } temp [ s . Ref ] = labelsToLabelsProto ( rl ) } for ref , labels := range temp { t . seriesSegmentIndexes [ ref ] = index // We should not ever be replacing a series labels in the map, but just // in case we do we need to ensure we do not leak the replaced interned // strings. if orig , ok := t . seriesLabels [ ref ] ; ok { release ( orig ) } t . seriesLabels [ ref ] = labels } }
// StoreSeries keeps track of which series we know about for lookups when sending samples to remote.
StoreSeries keeps track of which series we know about for lookups when sending samples to remote .