func (q externalLabelsQuerier) addExternalLabels(ms []*labels.Matcher) ([]*labels.Matcher, labels.Labels) {
	el := make(labels.Labels, len(q.externalLabels))
	copy(el, q.externalLabels)

	// ms won't be sorted, so have to O(n^2) the search.
	for _, m := range ms {
		for i := 0; i < len(el); {
			if el[i].Name == m.Name {
				el = el[:i+copy(el[i:], el[i+1:])]
				continue
			}
			i++
		}
	}

	for _, l := range el {
		m, err := labels.NewMatcher(labels.MatchEqual, l.Name, l.Value)
		if err != nil {
			panic(err)
		}
		ms = append(ms, m)
	}
	return ms, el
}
func (q externalLabelsQuerier) addExternalLabels(ms []*labels.Matcher) ([]*labels.Matcher, labels.Labels) {
	el := make(labels.Labels, len(q.externalLabels))
	copy(el, q.externalLabels)

	
	for _, m := range ms {
		for i := 0; i < len(el); {
			if el[i].Name == m.Name {
				el = el[:i+copy(el[i:], el[i+1:])]
				continue
			}
			i++
		}
	}

	for _, l := range el {
		m, err := labels.NewMatcher(labels.MatchEqual, l.Name, l.Value)
		if err != nil {
			panic(err)
		}
		ms = append(ms, m)
	}
	return ms, el
}
func ( q externalLabelsQuerier ) addExternalLabels ( ms [ ] * labels . Matcher ) ( [ ] * labels . Matcher , labels . Labels ) { el := make ( labels . Labels , len ( q . externalLabels ) ) copy ( el , q . externalLabels ) // ms won't be sorted, so have to O(n^2) the search. for _ , m := range ms { for i := 0 ; i < len ( el ) ; { if el [ i ] . Name == m . Name { el = el [ : i + copy ( el [ i : ] , el [ i + 1 : ] ) ] continue } i ++ } } for _ , l := range el { m , err := labels . NewMatcher ( labels . MatchEqual , l . Name , l . Value ) if err != nil { panic ( err ) } ms = append ( ms , m ) } return ms , el }
// addExternalLabels adds matchers for each external label. External labels
// that already have a corresponding user-supplied matcher are skipped, as we
// assume that the user explicitly wants to select a different value for them.
// We return the new set of matchers, along with a map of labels for which
// matchers were added, so that these can later be removed from the result
// time series again.
addExternalLabels adds matchers for each external label . External labels that already have a corresponding user - supplied matcher are skipped as we assume that the user explicitly wants to select a different value for them . We return the new set of matchers along with a map of labels for which matchers were added so that these can later be removed from the result time series again .