Skip to content

Commit

Permalink
Don't cause errors when no series are matched
Browse files Browse the repository at this point in the history
It's normal and not an error if a query does not match due to no
downstream stores. This is common when querying with external labels and
tiered query servers.

This bug was introduced in #5296

Fixes: #5862

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ committed Jan 29, 2023
1 parent 1b12ab9 commit 9e90ea0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ type ctxKey int
// StoreMatcherKey is the context key for the store's allow list.
const StoreMatcherKey = ctxKey(0)

// NoStoresMatchedError is returned if the query does match any data.
// This can happen with Query servers trees and external labels
var NoStoresMatchedError = errors.New("No StoreAPIs matched for this query")

// Client holds meta information about a store.
type Client interface {
// StoreClient to access the store.
Expand Down Expand Up @@ -278,12 +282,7 @@ func (s *ProxyStore) Series(originalRequest *storepb.SeriesRequest, srv storepb.
}

if len(stores) == 0 {
err := errors.New("No StoreAPIs matched for this query")
level.Debug(reqLogger).Log("err", err, "stores", strings.Join(storeDebugMsgs, ";"))
if sendErr := srv.Send(storepb.NewWarnSeriesResponse(err)); sendErr != nil {
level.Error(reqLogger).Log("err", sendErr)
return status.Error(codes.Unknown, errors.Wrap(sendErr, "send series response").Error())
}
level.Debug(reqLogger).Log("err", NoStoresMatchedError, "stores", strings.Join(storeDebugMsgs, ";"))
return nil
}

Expand Down

0 comments on commit 9e90ea0

Please sign in to comment.