-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6329 from fpetkovski/expose-tsdb-infos
Expose info for each TSDB
- Loading branch information
Showing
19 changed files
with
725 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.