-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store: selector labels from store #1059
Changes from all commits
fcc5c2e
ed59ed5
23d2d8a
ce4fe69
a8b9ba9
284e6b9
5cec0a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -215,7 +215,8 @@ type BucketStore struct { | |||
samplesLimiter *Limiter | ||||
partitioner partitioner | ||||
|
||||
filterConfig *FilterConfig | ||||
filterConfig *FilterConfig | ||||
selectorLabels labels.Labels | ||||
} | ||||
|
||||
// NewBucketStore creates a new bucket backed store that implements the store API against | ||||
|
@@ -232,6 +233,7 @@ func NewBucketStore( | |||
debugLogging bool, | ||||
blockSyncConcurrency int, | ||||
filterConf *FilterConfig, | ||||
selectorLabels labels.Labels, | ||||
) (*BucketStore, error) { | ||||
if logger == nil { | ||||
logger = log.NewNopLogger() | ||||
|
@@ -266,6 +268,7 @@ func NewBucketStore( | |||
samplesLimiter: NewLimiter(maxSampleCount, metrics.queriesDropped), | ||||
partitioner: gapBasedPartitioner{maxGapSize: maxGapSize}, | ||||
filterConfig: filterConf, | ||||
selectorLabels: selectorLabels, | ||||
} | ||||
s.metrics = metrics | ||||
|
||||
|
@@ -519,12 +522,19 @@ func (s *BucketStore) TimeRange() (mint, maxt int64) { | |||
// Info implements the storepb.StoreServer interface. | ||||
func (s *BucketStore) Info(context.Context, *storepb.InfoRequest) (*storepb.InfoResponse, error) { | ||||
mint, maxt := s.TimeRange() | ||||
// Store nodes hold global data and thus have no labels. | ||||
return &storepb.InfoResponse{ | ||||
|
||||
infoResp := &storepb.InfoResponse{ | ||||
StoreType: component.Store.ToProto(), | ||||
MinTime: mint, | ||||
MaxTime: maxt, | ||||
}, nil | ||||
Labels: make([]storepb.Label, 0, len(s.selectorLabels)), | ||||
} | ||||
|
||||
for _, lset := range s.selectorLabels { | ||||
infoResp.Labels = append(infoResp.Labels, storepb.Label{Name: lset.Name, Value: lset.Value}) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before this change we need to adjust Querier logic: Line 248 in 865d5ec
Otherwise, sidecar + store gateway will be assumed a "duplicate" in Querier. Let's think about how we can fix this. The storeAPI duplication detection logic is embedded in Querier to make sure user doesn't put many sidecars that upload blocks with the same external labels (common bug). I think we might want to change I only don't like the fact that for Querier all of this is no longer I might think we actually would need to change StoreType to Thoughts @povilasv @GiedriusS @brancz ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am I missing something or shouldn't this just be the set of all labelsets seen in all blocks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you elaborate? Or better: Let's maybe quickly write up some proposal as we want consistent thing everywhere we do selectors + maybe selecting prefixes as well. cc @jojohappy |
||||
} | ||||
|
||||
return infoResp, nil | ||||
} | ||||
|
||||
func (s *BucketStore) limitMinTime(mint int64) int64 { | ||||
|
@@ -772,7 +782,7 @@ func debugFoundBlockSetOverview(logger log.Logger, mint, maxt, maxResolutionMill | |||
} | ||||
|
||||
// Series implements the storepb.StoreServer interface. | ||||
func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_SeriesServer) (err error) { | ||||
func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_SeriesServer) error { | ||||
{ | ||||
span, _ := tracing.StartSpan(srv.Context(), "store_query_gate_ismyturn") | ||||
err := s.queryGate.IsMyTurn(srv.Context()) | ||||
|
@@ -783,10 +793,19 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_Serie | |||
} | ||||
defer s.queryGate.Done() | ||||
|
||||
matchers, err := translateMatchers(req.Matchers) | ||||
match, matchers, err := matchesExternalLabels(req.Matchers, s.selectorLabels) | ||||
if err != nil { | ||||
return status.Error(codes.InvalidArgument, err.Error()) | ||||
} | ||||
if !match { | ||||
return nil | ||||
} | ||||
|
||||
newMatchers, err := translateMatchers(matchers) | ||||
if err != nil { | ||||
return status.Error(codes.InvalidArgument, err.Error()) | ||||
} | ||||
|
||||
req.MinTime = s.limitMinTime(req.MinTime) | ||||
req.MaxTime = s.limitMaxTime(req.MaxTime) | ||||
|
||||
|
@@ -799,7 +818,7 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_Serie | |||
s.mtx.RLock() | ||||
|
||||
for _, bs := range s.blockSets { | ||||
blockMatchers, ok := bs.labelMatchers(matchers...) | ||||
blockMatchers, ok := bs.labelMatchers(newMatchers...) | ||||
if !ok { | ||||
continue | ||||
} | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On each component that works on the object storage (e.g Store GW and Compactor), add
--selector.relabel-config
(and corresponding--selector.relabel-config-file
) as in proposalThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On top of this we want to make sure Info() endpoint has exact labels of blocks that we shard.