web/api/v1/api.go
func mergeLabels(primary, secondary []prompb.Label) []prompb.Label {
	result := make([]prompb.Label, 0, len(primary)+len(secondary))
	i, j := 0, 0
	for i < len(primary) && j < len(secondary) {
		if primary[i].Name < secondary[j].Name {
			result = append(result, primary[i])
			i++
		} else if primary[i].Name > secondary[j].Name {
			result = append(result, secondary[j])
			j++
		} else {
			result = append(result, primary[i])
			i++
			j++
		}
	}
	for ; i < len(primary); i++ {
		result = append(result, primary[i])
	}
	for ; j < len(secondary); j++ {
		result = append(result, secondary[j])
	}
	return result
}
func mergeLabels(primary, secondary []prompb.Label) []prompb.Label {
	result := make([]prompb.Label, 0, len(primary)+len(secondary))
	i, j := 0, 0
	for i < len(primary) && j < len(secondary) {
		if primary[i].Name < secondary[j].Name {
			result = append(result, primary[i])
			i++
		} else if primary[i].Name > secondary[j].Name {
			result = append(result, secondary[j])
			j++
		} else {
			result = append(result, primary[i])
			i++
			j++
		}
	}
	for ; i < len(primary); i++ {
		result = append(result, primary[i])
	}
	for ; j < len(secondary); j++ {
		result = append(result, secondary[j])
	}
	return result
}
func mergeLabels ( primary , secondary [ ] prompb . Label ) [ ] prompb . Label { result := make ( [ ] prompb . Label , 0 , len ( primary ) + len ( secondary ) ) i , j := 0 , 0 for i < len ( primary ) && j < len ( secondary ) { if primary [ i ] . Name < secondary [ j ] . Name { result = append ( result , primary [ i ] ) i ++ } else if primary [ i ] . Name > secondary [ j ] . Name { result = append ( result , secondary [ j ] ) j ++ } else { result = append ( result , primary [ i ] ) i ++ j ++ } } for ; i < len ( primary ) ; i ++ { result = append ( result , primary [ i ] ) } for ; j < len ( secondary ) ; j ++ { result = append ( result , secondary [ j ] ) } return result }
// mergeLabels merges two sets of sorted proto labels, preferring those in
// primary to those in secondary when there is an overlap.
mergeLabels merges two sets of sorted proto labels preferring those in primary to those in secondary when there is an overlap .