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

Expose info for each TSDB #6329

Merged
merged 2 commits into from
May 8, 2023
Merged
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
2 changes: 1 addition & 1 deletion cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,12 @@ func runQuery(
info.WithStoreInfoFunc(func() *infopb.StoreInfo {
if httpProbe.IsReady() {
mint, maxt := proxy.TimeRange()

return &infopb.StoreInfo{
MinTime: mint,
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: proxy.TSDBInfos(),
}
}
return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ func runReceive(
MaxTime: maxTime,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: proxy.TSDBInfos(),
}
}
return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ func runRule(
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: tsdbStore.TSDBInfos(),
}
}
return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func runSidecar(
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: promStore.TSDBInfos(),
}
}
return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ func runStore(
MaxTime: maxt,
SupportsSharding: true,
SupportsWithoutReplicaLabels: true,
TsdbInfos: bs.TSDBInfos(),
}
}
return nil
Expand Down
40 changes: 40 additions & 0 deletions pkg/info/infopb/custom.pb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package infopb

import (
"math"

"github.com/prometheus/prometheus/model/labels"

"github.com/thanos-io/thanos/pkg/store/labelpb"
)

func NewTSDBInfo(mint, maxt int64, lbls []labelpb.ZLabel) TSDBInfo {
return TSDBInfo{
Labels: labelpb.ZLabelSet{
Labels: lbls,
},
MinTime: mint,
MaxTime: maxt,
}
}

type TSDBInfos []TSDBInfo

func (infos TSDBInfos) MaxT() int64 {
var maxt int64 = math.MinInt64
for _, info := range infos {
if info.MaxTime > maxt {
maxt = info.MaxTime
}
}
return maxt
}

func (infos TSDBInfos) LabelSets() []labels.Labels {
lsets := make([]labels.Labels, 0, len(infos))
for _, info := range infos {
lsets = append(lsets, labelpb.ZLabelsToPromLabels(info.Labels.Labels))

}
return lsets
}
Loading