Skip to content

Commit

Permalink
Added -querier.max-query-lookback and fixed -querier.max-query-into-f…
Browse files Browse the repository at this point in the history
…uture (grafana#3452)

* Added querier max-query-lookback and fixed max-query-into-future

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Updated PR number

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Fixed tests

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Removed dead code

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Added warning for the deprecated flag

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Addressed review comments

Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci authored Nov 4, 2020
1 parent 6956ab3 commit 0261243
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"sync"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -18,6 +19,7 @@ import (
"github.com/cortexproject/cortex/pkg/chunk/cache"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/extract"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/spanlogger"
"github.com/cortexproject/cortex/pkg/util/validation"
)
Expand Down Expand Up @@ -74,11 +76,16 @@ func (cfg *StoreConfig) RegisterFlags(f *flag.FlagSet) {
cfg.WriteDedupeCacheConfig.RegisterFlagsWithPrefix("store.index-cache-write.", "Cache config for index entry writing. ", f)

f.Var(&cfg.CacheLookupsOlderThan, "store.cache-lookups-older-than", "Cache index entries older than this period. 0 to disable.")
f.Var(&cfg.MaxLookBackPeriod, "store.max-look-back-period", "Limit how long back data can be queried")
f.Var(&cfg.MaxLookBackPeriod, "store.max-look-back-period", "Deprecated: use -querier.max-query-lookback instead. Limit how long back data can be queried. This setting applies to chunks storage only.") // To be removed in Cortex 1.8.
}

// Validate validates the store config.
func (cfg *StoreConfig) Validate() error {
func (cfg *StoreConfig) Validate(logger log.Logger) error {
if cfg.MaxLookBackPeriod > 0 {
flagext.DeprecatedFlagsUsed.Inc()
level.Warn(logger).Log("msg", "running with DEPRECATED flag -store.max-look-back-period, use -querier.max-query-lookback instead.")
}

if err := cfg.ChunkCacheConfig.Validate(); err != nil {
return err
}
Expand Down

0 comments on commit 0261243

Please sign in to comment.