Skip to content
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

Add compatibility for sort without ext labels #6451

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,12 @@ func runQuery(
if httpProbe.IsReady() {
mint, maxt := proxy.TimeRange()
return &infopb.StoreInfo{
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: proxy.TSDBInfos(),
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
SupportsSortWithoutExternalLabels: true,
TsdbInfos: proxy.TSDBInfos(),
}
}
return nil
Expand Down
11 changes: 6 additions & 5 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,12 @@ func runReceive(
if httpProbe.IsReady() {
minTime, maxTime := proxy.TimeRange()
return &infopb.StoreInfo{
MinTime: minTime,
MaxTime: maxTime,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: proxy.TSDBInfos(),
MinTime: minTime,
MaxTime: maxTime,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
SupportsSortWithoutExternalLabels: true,
TsdbInfos: proxy.TSDBInfos(),
}
}
return nil
Expand Down
11 changes: 6 additions & 5 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,12 @@ func runRule(
if httpProbe.IsReady() {
mint, maxt := tsdbStore.TimeRange()
return &infopb.StoreInfo{
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: tsdbStore.TSDBInfos(),
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
SupportsSortWithoutExternalLabels: true,
TsdbInfos: tsdbStore.TSDBInfos(),
}
}
return nil
Expand Down
11 changes: 6 additions & 5 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,12 @@ func runSidecar(
if httpProbe.IsReady() {
mint, maxt := promStore.Timestamps()
return &infopb.StoreInfo{
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: promStore.TSDBInfos(),
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
SupportsSortWithoutExternalLabels: true,
TsdbInfos: promStore.TSDBInfos(),
}
}
return nil
Expand Down
11 changes: 6 additions & 5 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,12 @@ func runStore(
if httpProbe.IsReady() {
mint, maxt := bs.TimeRange()
return &infopb.StoreInfo{
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: bs.TSDBInfos(),
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
SupportsSortWithoutExternalLabels: true,
TsdbInfos: bs.TSDBInfos(),
}
}
return nil
Expand Down
114 changes: 76 additions & 38 deletions pkg/info/infopb/rpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/info/infopb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ message StoreInfo {

// TSDBInfos holds metadata for all TSDBs exposed by the store.
repeated TSDBInfo tsdb_infos = 6 [(gogoproto.nullable) = false];

// supports_sort_without_external_labels indicates whether the store ignores external labels
// when comparing two label sets.
bool supports_sort_without_external_labels = 7;
}

// RulesInfo holds the metadata related to Rules API exposed by the component.
Expand Down
11 changes: 11 additions & 0 deletions pkg/query/endpointset.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,17 @@ func (er *endpointRef) SupportsWithoutReplicaLabels() bool {
return er.metadata.Store.SupportsWithoutReplicaLabels
}

func (er *endpointRef) SupportsSortWithoutExternalLabels() bool {
er.mtx.RLock()
defer er.mtx.RUnlock()

if er.metadata == nil || er.metadata.Store == nil {
return false
}

return er.metadata.Store.SupportsSortWithoutExternalLabels
}

func (er *endpointRef) String() string {
mint, maxt := er.TimeRange()
return fmt.Sprintf(
Expand Down
4 changes: 4 additions & 0 deletions pkg/query/internal/test-storeset-pre-v0.8.0/storeset.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ func (s *storeRef) SupportsWithoutReplicaLabels() bool {
return false
}

func (s *storeRef) SupportsSortWithoutExternalLabels() bool {
return false
}

func (s *storeRef) String() string {
mint, maxt := s.TimeRange()
return fmt.Sprintf(
Expand Down
4 changes: 4 additions & 0 deletions pkg/receive/multitsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ func (l *localClient) SupportsWithoutReplicaLabels() bool {
return true
}

func (l *localClient) SupportsSortWithoutExternalLabels() bool {
return true
}

type tenant struct {
readyS *ReadyStorage
storeTSDB *store.TSDBStore
Expand Down
4 changes: 4 additions & 0 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ type Client interface {
// and sorted response is supported by the underlying store.
SupportsWithoutReplicaLabels() bool

// SupportsSortWithoutExternalLabels returns true if the store sorts series
// with external labels excluded from the comparison function.
SupportsSortWithoutExternalLabels() bool

// String returns the string representation of the store client.
String() string

Expand Down
Loading