Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
benclive committed Aug 27, 2024
1 parent c99b85e commit ed7361b
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions pkg/querier-rf1/wal/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ import (
"bytes"
"context"
"io"
"net/http"
"sort"
"sync"
"time"

"github.com/go-kit/kit/log/level"
"github.com/grafana/dskit/httpgrpc"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
Expand All @@ -31,8 +27,6 @@ import (
"github.com/grafana/loki/v3/pkg/storage/wal/chunks"
"github.com/grafana/loki/v3/pkg/storage/wal/index"
"github.com/grafana/loki/v3/pkg/util"
"github.com/grafana/loki/v3/pkg/util/spanlogger"
util_validation "github.com/grafana/loki/v3/pkg/util/validation"
)

// TODO: Replace with the querier.Querier interface once we have support for all the methods.
Expand Down Expand Up @@ -395,27 +389,3 @@ func (q *Querier) forIndices(ctx context.Context, req *metastorepb.ListBlocksFor
}
return g.Wait()
}

func validateQueryTimeRangeLimits(ctx context.Context, userID string, limits querier.TimeRangeLimits, from, through time.Time) (time.Time, time.Time, error) {
now := nowFunc()
// Clamp the time range based on the max query lookback.
maxQueryLookback := limits.MaxQueryLookback(ctx, userID)
if maxQueryLookback > 0 && from.Before(now.Add(-maxQueryLookback)) {
origStartTime := from
from = now.Add(-maxQueryLookback)

level.Debug(spanlogger.FromContext(ctx)).Log(
"msg", "the start time of the query has been manipulated because of the 'max query lookback' setting",
"original", origStartTime,
"updated", from)

}
maxQueryLength := limits.MaxQueryLength(ctx, userID)
if maxQueryLength > 0 && (through).Sub(from) > maxQueryLength {
return time.Time{}, time.Time{}, httpgrpc.Errorf(http.StatusBadRequest, util_validation.ErrQueryTooLong, (through).Sub(from), model.Duration(maxQueryLength))
}
if through.Before(from) {
return time.Time{}, time.Time{}, httpgrpc.Errorf(http.StatusBadRequest, util_validation.ErrQueryTooOld, model.Duration(maxQueryLookback))
}
return from, through, nil
}

0 comments on commit ed7361b

Please sign in to comment.