Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* [ENHANCEMENT] Experimental TSDB: Added `cortex_querier_blocks_meta_synced`, which reflects current state of synced blocks over all tenants. #2392
* [ENHANCEMENT] Added `cortex_distributor_latest_seen_sample_timestamp_seconds` metric to see how far behind Prometheus servers are in sending data. #2371
* [ENHANCEMENT] FIFO cache to support eviction based on memory usage. The `-<prefix>.fifocache.size` CLI flag has been renamed to `-<prefix>.fifocache.max-size-items` as well as its YAML config option `size` renamed to `max_size_items`. Added `-<prefix>.fifocache.max-size-bytes` CLI flag and YAML config option `max_size_bytes` to specify memory limit of the cache. #2319
* [ENHANCEMENT] Allow 1w (where w denotes week) and 1y (where y denotes year) when setting `-store.cache-lookups-older-than` and `-store.max-look-back-period`. #2454
* [BUGFIX] Fixes #2411, Ensure requests are properly routed to the prometheus api embedded in the query if `-server.path-prefix` is set. #2372
* [BUGFIX] Experimental TSDB: fixed chunk data corruption when querying back series using the experimental blocks storage. #2400
* [BUGFIX] Cassandra Storage: Fix endpoint TLS host verification. #2109
Expand Down
10 changes: 5 additions & 5 deletions pkg/chunk/chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ type StoreConfig struct {
ChunkCacheConfig cache.Config `yaml:"chunk_cache_config"`
WriteDedupeCacheConfig cache.Config `yaml:"write_dedupe_cache_config"`

CacheLookupsOlderThan time.Duration `yaml:"cache_lookups_older_than"`
CacheLookupsOlderThan model.Duration `yaml:"cache_lookups_older_than"`

// Limits query start time to be greater than now() - MaxLookBackPeriod, if set.
MaxLookBackPeriod time.Duration `yaml:"max_look_back_period"`
MaxLookBackPeriod model.Duration `yaml:"max_look_back_period"`

// Not visible in yaml because the setting shouldn't be common between ingesters and queriers.
// This exists in case we don't want to cache all the chunks but still want to take advantage of
Expand All @@ -67,8 +67,8 @@ func (cfg *StoreConfig) RegisterFlags(f *flag.FlagSet) {
f.BoolVar(&cfg.chunkCacheStubs, "store.chunks-cache.cache-stubs", false, "If true, don't write the full chunk to cache, just a stub entry.")
cfg.WriteDedupeCacheConfig.RegisterFlagsWithPrefix("store.index-cache-write.", "Cache config for index entry writing. ", f)

f.DurationVar(&cfg.CacheLookupsOlderThan, "store.cache-lookups-older-than", 0, "Cache index entries older than this period. 0 to disable.")
f.DurationVar(&cfg.MaxLookBackPeriod, "store.max-look-back-period", 0, "Limit how long back data can be queried")
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")
}

type baseStore struct {
Expand Down Expand Up @@ -293,7 +293,7 @@ func (c *baseStore) validateQueryTimeRange(ctx context.Context, userID string, f
}

if c.cfg.MaxLookBackPeriod != 0 {
oldestStartTime := model.Now().Add(-c.cfg.MaxLookBackPeriod)
oldestStartTime := model.Now().Add(-time.Duration(c.cfg.MaxLookBackPeriod))
if oldestStartTime.After(*from) {
*from = oldestStartTime
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/chunk/chunk_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ func TestStoreMaxLookBack(t *testing.T) {
storeWithoutLookBackLimit := newTestChunkStoreConfig(t, "v9", storeCfg)
defer storeWithoutLookBackLimit.Stop()

storeCfg.MaxLookBackPeriod = 30 * time.Minute
storeCfg.MaxLookBackPeriod = model.Duration(30 * time.Minute)
storeWithLookBackLimit := newTestChunkStoreConfig(t, "v9", storeCfg)
defer storeWithLookBackLimit.Stop()

Expand Down
3 changes: 2 additions & 1 deletion pkg/chunk/series_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"time"

"github.com/go-kit/kit/log/level"
jsoniter "github.com/json-iterator/go"
Expand Down Expand Up @@ -78,7 +79,7 @@ func newSeriesStore(cfg StoreConfig, schema SeriesStoreSchema, index IndexClient
if cfg.CacheLookupsOlderThan != 0 {
schema = &schemaCaching{
SeriesStoreSchema: schema,
cacheOlderThan: cfg.CacheLookupsOlderThan,
cacheOlderThan: time.Duration(cfg.CacheLookupsOlderThan),
}
}

Expand Down