storage/fanout.go
func NewMergeQuerier(primaryQuerier Querier, queriers []Querier) Querier {
	filtered := make([]Querier, 0, len(queriers))
	for _, querier := range queriers {
		if querier != NoopQuerier() {
			filtered = append(filtered, querier)
		}
	}

	setQuerierMap := make(map[SeriesSet]Querier)
	failedQueriers := make(map[Querier]struct{})

	switch len(filtered) {
	case 0:
		return NoopQuerier()
	case 1:
		return filtered[0]
	default:
		return &mergeQuerier{
			primaryQuerier: primaryQuerier,
			queriers:       filtered,
			failedQueriers: failedQueriers,
			setQuerierMap:  setQuerierMap,
		}
	}
}
func NewMergeQuerier(primaryQuerier Querier, queriers []Querier) Querier {
	filtered := make([]Querier, 0, len(queriers))
	for _, querier := range queriers {
		if querier != NoopQuerier() {
			filtered = append(filtered, querier)
		}
	}

	setQuerierMap := make(map[SeriesSet]Querier)
	failedQueriers := make(map[Querier]struct{})

	switch len(filtered) {
	case 0:
		return NoopQuerier()
	case 1:
		return filtered[0]
	default:
		return &mergeQuerier{
			primaryQuerier: primaryQuerier,
			queriers:       filtered,
			failedQueriers: failedQueriers,
			setQuerierMap:  setQuerierMap,
		}
	}
}
func NewMergeQuerier ( primaryQuerier Querier , queriers [ ] Querier ) Querier { filtered := make ( [ ] Querier , 0 , len ( queriers ) ) for _ , querier := range queriers { if querier != NoopQuerier ( ) { filtered = append ( filtered , querier ) } } setQuerierMap := make ( map [ SeriesSet ] Querier ) failedQueriers := make ( map [ Querier ] struct { } ) switch len ( filtered ) { case 0 : return NoopQuerier ( ) case 1 : return filtered [ 0 ] default : return & mergeQuerier { primaryQuerier : primaryQuerier , queriers : filtered , failedQueriers : failedQueriers , setQuerierMap : setQuerierMap , } } }
// NewMergeQuerier returns a new Querier that merges results of input queriers.
// NB NewMergeQuerier will return NoopQuerier if no queriers are passed to it,
// and will filter NoopQueriers from its arguments, in order to reduce overhead
// when only one querier is passed.
NewMergeQuerier returns a new Querier that merges results of input queriers . NB NewMergeQuerier will return NoopQuerier if no queriers are passed to it and will filter NoopQueriers from its arguments in order to reduce overhead when only one querier is passed .