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

store/proxy: set {Min,Max}Time accordingly to the nodes #982

Merged
merged 2 commits into from
Mar 28, 2019
Merged
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
28 changes: 25 additions & 3 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,31 @@ func (s *ProxyStore) Info(ctx context.Context, r *storepb.InfoRequest) (*storepb
res := &storepb.InfoResponse{
Labels: make([]storepb.Label, 0, len(s.selectorLabels)),
StoreType: s.component.ToProto(),
MinTime: 0,
MaxTime: math.MaxInt64,
}

MinTime := int64(math.MaxInt64)
MaxTime := int64(0)

stores := s.stores()
for _, s := range stores {
mint, maxt := s.TimeRange()
if mint < MinTime {
MinTime = mint
}
if maxt > MaxTime {
MaxTime = maxt
}
}

// Edge case: we have all of the data if there are no stores.
if len(stores) == 0 {
MinTime = 0
MaxTime = math.MaxInt64
}

res.MaxTime = MaxTime
res.MinTime = MinTime

for _, l := range s.selectorLabels {
res.Labels = append(res.Labels, storepb.Label{
Name: l.Name,
Expand Down Expand Up @@ -393,7 +415,7 @@ func (s *ProxyStore) LabelValues(ctx context.Context, r *storepb.LabelValuesRequ
store := st
g.Go(func() error {
resp, err := store.LabelValues(gctx, &storepb.LabelValuesRequest{
Label: r.Label,
Label: r.Label,
PartialResponseDisabled: r.PartialResponseDisabled,
})
if err != nil {
Expand Down