Skip to content

Commit

Permalink
proxy: make strategy tunable
Browse files Browse the repository at this point in the history
Signed-off-by: Giedrius Statkevičius <[email protected]>
  • Loading branch information
GiedriusS committed May 30, 2022
1 parent 244f2fc commit fc4cd7a
Show file tree
Hide file tree
Showing 2 changed files with 256 additions and 71 deletions.
14 changes: 9 additions & 5 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,19 @@ func (s *ProxyStore) Series(originalRequest *storepb.SeriesRequest, srv storepb.
}

var (
storeResponses = make([]*lazyRespSet, len(stores))
storeResponses = make([]respSet, len(stores))
)

for i, st := range stores {
storeDebugMsgs = append(storeDebugMsgs, fmt.Sprintf("Store %s queried", st))

st := st
storeResponses[i] = newLazyRespSet(srv.Context(), st, r, s.responseTimeout)
defer storeResponses[i].Close()
respSet, err := newAsyncRespSet(srv.Context(), st, r, s.responseTimeout, EagerRetrieval)
if err != nil {
return status.Error(codes.Unknown, errors.Wrapf(err, "starting %s stream", st.String()).Error())
}
storeResponses[i] = respSet
defer respSet.Close()
}

if len(stores) == 0 {
Expand Down Expand Up @@ -328,12 +332,12 @@ func (s *ProxyStore) Series(originalRequest *storepb.SeriesRequest, srv storepb.
return errors.Wrap(err, "send series response")
}
} else {
storeID := labelpb.PromLabelSetsToString(respSet.st.LabelSets())
storeID := respSet.Labelset()
if storeID == "" {
storeID = "Store Gateway"
}

return errors.Wrapf(respSet.Err(), "fetch series for %s %s", storeID, respSet.st)
return errors.Wrapf(respSet.Err(), "fetch series for %s %s", storeID, respSet.StoreID())
}
}

Expand Down
Loading

0 comments on commit fc4cd7a

Please sign in to comment.