-
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.
This commit exposes the label set alongside the min and max time for each TSDB covered by a Store. This information is used to scope the min time for a remote query so that we do not produce partial aggregates in distriuted mode. Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
- Loading branch information
1 parent
6d838e7
commit f855642
Showing
20 changed files
with
698 additions
and
98 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.