Skip to content
Open
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## master / unreleased
* [FEATURE] Engine: Add `-querier.selector-batch-size` and `-ruler.selector-batch-size` flags to configure series batching in the Thanos promQL engine. 0 disables batching. #7763
* [CHANGE] Ruler: Remove the deprecated `-ruler.evaluation-delay-duration` flag and its `ruler_evaluation_delay_duration` per-tenant limit. Use `-ruler.query-offset` / `ruler_query_offset`, which no longer takes the higher of the two values. Cortex decodes the runtime config strictly, so a leftover `ruler_evaluation_delay_duration` override will not crash the process: it makes every runtime config reload fail, pinning the last good overrides and dropping `cortex_runtime_config_last_reload_successful` to 0. Run `grep -r ruler_evaluation_delay_duration` over your runtime configs before upgrading. #7792
* [CHANGE] Remove the deprecated `-<prefix>.fifocache.size` flag and its `size` YAML field (deprecated in 1.1.0). Use `-<prefix>.fifocache.max-size-items` or `-<prefix>.fifocache.max-size-bytes`; a cache configured only via `size` now starts with no capacity. #7791
* [CHANGE] Querier: Remove the deprecated `-querier.ingester-metadata-streaming` flag and its `ingester_metadata_streaming` YAML field (deprecated in 1.18.0, default `true`). Streaming RPCs are now always used for the metadata APIs. Also removes the dead hidden `ingester_streaming` YAML field left over from `-querier.ingester-streaming`. #7791
* [CHANGE] Remove deprecated CLI flags that have been no-ops for at least two minor releases. All of them were flag-only (no YAML config option) and already had no effect, so the only impact is that passing them now fails at startup. Remove them from your command lines before upgrading. #7790
- `-querier.ingester-streaming` (deprecated in 1.17.0)
- `-querier.iterators` (deprecated in 1.17.0)
- `-querier.batch-iterators` (deprecated in 1.17.0)
- `-querier.query-store-for-labels-enabled` (deprecated in 1.18.0)
- `-querier.max-outstanding-requests-per-tenant` (deprecated in 1.18.0; use `-frontend.max-outstanding-requests-per-tenant`)
- `-query-scheduler.max-outstanding-requests-per-tenant` (deprecated in 1.18.0; use `-frontend.max-outstanding-requests-per-tenant`)
- `-blocks-storage.tsdb.wal-compression-enabled` (deprecated in 1.19.0; use `-blocks-storage.tsdb.wal-compression-type`)
- `-ingester.max-series-per-query` (a chunks-storage limit, ignored since blocks storage; use `-querier.max-fetched-series-per-query`)
* [CHANGE] Querier: Make query time range configurations per-tenant: `query_ingesters_within`, `query_store_after`, and `shuffle_sharding_ingesters_lookback_period`. Uses `model.Duration` instead of `time.Duration` to support serialization but has minimum unit of 1ms (nanoseconds/microseconds not supported). #7160
* [CHANGE] Cache: Setting `-blocks-storage.bucket-store.metadata-cache.bucket-index-content-ttl` to 0 will disable the bucket-index cache. #7446
* [CHANGE] HA Tracker: Move `-distributor.ha-tracker.failover-timeout` from a global config to a per-tenant runtime config. The flag name and default value (30s) remain the same. #7481
Expand Down
6 changes: 0 additions & 6 deletions docs/blocks-storage/migrate-from-chunks-to-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ Querier (and ruler) can be reconfigured to use `blocks` as "primary" store to se
- `-store.engine=blocks`
- `-querier.second-store-engine=chunks`
- `-querier.use-second-store-before-time=<timestamp after ingesters migration has completed>`
- `-querier.ingester-streaming=true`

#### `-querier.use-second-store-before-time`

Expand All @@ -135,7 +134,6 @@ During the rollback, queriers and rulers need to use the same configuration chan
- `-store.engine=chunks`
- `-querier.second-store-engine=blocks`
- `-querier.use-second-store-before-time` should not be set
- `-querier.ingester-streaming=false`

Once the rollback is complete, some configuration changes need to stay in place, because some data has already been stored to blocks:

Expand Down Expand Up @@ -241,16 +239,12 @@ Most important thing is generating resources with blocks configuration, and expo

// Querier and ruler configuration used during migration, and after.
query_config_during_migration:: {
// Disable streaming, as it is broken when querying both chunks and blocks ingesters at the same time.
'querier.ingester-streaming': 'false',

// query-store-after is required during migration, since new ingesters running on blocks will not load any chunks from chunks-WAL.
// All such chunks are however flushed to the store.
'querier.query-store-after': '0',
},

query_config_after_migration:: {
'querier.ingester-streaming': 'true',
'querier.query-ingesters-within': '13h', // TSDB ingesters have data for up to 4d.
'querier.query-store-after': '12h', // Can be enabled once blocks ingesters are running for 12h.

Expand Down
5 changes: 0 additions & 5 deletions docs/blocks-storage/querier.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ querier:
# CLI flag: -querier.timeout
[timeout: <duration> | default = 2m]

# Deprecated (This feature will be always on after v1.18): Use streaming RPCs
# for metadata APIs from ingester.
# CLI flag: -querier.ingester-metadata-streaming
[ingester_metadata_streaming: <boolean> | default = true]

# Use LabelNames ingester RPCs with match params.
# CLI flag: -querier.ingester-label-names-with-matchers
[ingester_label_names_with_matchers: <boolean> | default = false]
Expand Down
16 changes: 0 additions & 16 deletions docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3844,11 +3844,6 @@ The `fifo_cache_config` configures the local in-memory cache.
# The expiry duration for the cache.
# CLI flag: -frontend.fifocache.duration
[validity: <duration> | default = 0s]

# Deprecated (use max-size-items or max-size-bytes instead): The number of
# entries to cache.
# CLI flag: -frontend.fifocache.size
[size: <int> | default = 0]
```

### `flusher_config`
Expand Down Expand Up @@ -4830,12 +4825,6 @@ query_rejection:
# them.
[query_attributes: <list of QueryAttribute> | default = []]

# Deprecated(use ruler.query-offset instead) and will be removed in v1.19.0:
# Duration to delay the evaluation of rules to ensure the underlying metrics
# have been pushed to Cortex.
# CLI flag: -ruler.evaluation-delay-duration
[ruler_evaluation_delay_duration: <duration> | default = 0s]

# The default tenant's shard size when the shuffle-sharding strategy is used by
# ruler. When this setting is specified in the per-tenant overrides, a value of
# 0 disables shuffle sharding for the tenant. If the value is < 1 the shard size
Expand Down Expand Up @@ -5274,11 +5263,6 @@ The `querier_config` configures the Cortex querier.
# CLI flag: -querier.timeout
[timeout: <duration> | default = 2m]

# Deprecated (This feature will be always on after v1.18): Use streaming RPCs
# for metadata APIs from ingester.
# CLI flag: -querier.ingester-metadata-streaming
[ingester_metadata_streaming: <boolean> | default = true]

# Use LabelNames ingester RPCs with match params.
# CLI flag: -querier.ingester-label-names-with-matchers
[ingester_label_names_with_matchers: <boolean> | default = false]
Expand Down
19 changes: 5 additions & 14 deletions integration/ruler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,6 @@ func TestRulerMetricsForInvalidQueries(t *testing.T) {
// Evaluate rules often, so that we don't need to wait for metrics to show up.
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
// No delay
"-ruler.evaluation-delay-duration": "0",

"-blocks-storage.tsdb.block-ranges-period": "1h",
"-blocks-storage.bucket-store.sync-interval": "1s",
Expand Down Expand Up @@ -1266,8 +1264,6 @@ func TestRulerMetricsWhenIngesterFails(t *testing.T) {
// Evaluate rules often, so that we don't need to wait for metrics to show up.
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
// No delay
"-ruler.evaluation-delay-duration": "0",

// We run single ingester only, no replication.
"-distributor.replication-factor": "1",
Expand Down Expand Up @@ -1370,8 +1366,6 @@ func TestRulerDisablesRuleGroups(t *testing.T) {
// Evaluate rules often, so that we don't need to wait for metrics to show up.
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
// No delay
"-ruler.evaluation-delay-duration": "0",

// We run single ingester only, no replication.
"-distributor.replication-factor": "1",
Expand Down Expand Up @@ -1628,8 +1622,6 @@ func TestRulerKeepFiring(t *testing.T) {
// Evaluate rules often, so that we don't need to wait for metrics to show up.
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
// No delay
"-ruler.evaluation-delay-duration": "0",

"-blocks-storage.tsdb.block-ranges-period": "1h",
"-blocks-storage.bucket-store.sync-interval": "1s",
Expand Down Expand Up @@ -1901,12 +1893,11 @@ func TestRulerXFunctionsWithThanosEngine(t *testing.T) {
BlocksStorageFlags(),
RulerFlags(),
map[string]string{
"-querier.thanos-engine": "true",
"-querier.enable-x-functions": "true",
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
"-ruler.evaluation-delay-duration": "0",
"-distributor.replication-factor": "1",
"-querier.thanos-engine": "true",
"-querier.enable-x-functions": "true",
"-ruler.evaluation-interval": "2s",
"-ruler.poll-interval": "2s",
"-distributor.replication-factor": "1",
},
)

Expand Down
11 changes: 0 additions & 11 deletions pkg/chunk/cache/fifo_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/cortexproject/cortex/pkg/util/flagext"
)

const (
Expand All @@ -33,17 +31,13 @@ type FifoCacheConfig struct {
MaxSizeBytes string `yaml:"max_size_bytes"`
MaxSizeItems int `yaml:"max_size_items"`
Validity time.Duration `yaml:"validity"`

DeprecatedSize int `yaml:"size"`
}

// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
func (cfg *FifoCacheConfig) RegisterFlagsWithPrefix(prefix, description string, f *flag.FlagSet) {
f.StringVar(&cfg.MaxSizeBytes, prefix+"fifocache.max-size-bytes", "", description+"Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be applied.")
f.IntVar(&cfg.MaxSizeItems, prefix+"fifocache.max-size-items", 0, description+"Maximum number of entries in the cache.")
f.DurationVar(&cfg.Validity, prefix+"fifocache.duration", 0, description+"The expiry duration for the cache.")

f.IntVar(&cfg.DeprecatedSize, prefix+"fifocache.size", 0, "Deprecated (use max-size-items or max-size-bytes instead): "+description+"The number of entries to cache. ")
}

func (cfg *FifoCacheConfig) Validate() error {
Expand Down Expand Up @@ -93,11 +87,6 @@ type cacheEntry struct {

// NewFifoCache returns a new initialised FifoCache of size.
func NewFifoCache(name string, cfg FifoCacheConfig, reg prometheus.Registerer, logger log.Logger) *FifoCache {
if cfg.DeprecatedSize > 0 {
flagext.DeprecatedFlagsUsed.Inc()
level.Warn(logger).Log("msg", "running with DEPRECATED flag fifocache.size, use fifocache.max-size-items or fifocache.max-size-bytes instead", "cache", name)
cfg.MaxSizeItems = cfg.DeprecatedSize
}
maxSizeBytes, _ := parsebytes(cfg.MaxSizeBytes)

if maxSizeBytes == 0 && cfg.MaxSizeItems == 0 {
Expand Down
5 changes: 0 additions & 5 deletions pkg/frontend/v1/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import (
"github.com/cortexproject/cortex/pkg/frontend/v1/frontendv1pb"
"github.com/cortexproject/cortex/pkg/querier/stats"
"github.com/cortexproject/cortex/pkg/scheduler/queue"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/httpgrpcutil"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/cortexproject/cortex/pkg/util/services"
"github.com/cortexproject/cortex/pkg/util/users"
"github.com/cortexproject/cortex/pkg/util/validation"
Expand All @@ -38,9 +36,6 @@ type Config struct {

// RegisterFlags adds the flags required to config this to the given FlagSet.
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
//lint:ignore faillint Need to pass the global logger like this for warning on deprecated methods
flagext.DeprecatedFlag(f, "querier.max-outstanding-requests-per-tenant", "Deprecated: Use frontend.max-outstanding-requests-per-tenant instead.", util_log.Logger)

f.DurationVar(&cfg.QuerierForgetDelay, "query-frontend.querier-forget-delay", 0, "If a querier disconnects without sending notification about graceful shutdown, the query-frontend will keep the querier in the tenant's shard until the forget delay has passed. This feature is useful to reduce the blast radius when shuffle-sharding is enabled.")
}

Expand Down
65 changes: 9 additions & 56 deletions pkg/querier/distributor_queryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,18 @@ const retryMaxBackoff = 5 * time.Millisecond
type Distributor interface {
QueryStream(ctx context.Context, from, to model.Time, partialDataEnabled bool, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error)
QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error)
LabelValuesForLabelName(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error)
LabelValuesForLabelNameStream(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error)
LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints, bool, ...*labels.Matcher) ([]string, error)
LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints, bool, ...*labels.Matcher) ([]string, error)
MetricsForLabelMatchers(ctx context.Context, from, through model.Time, hint *storage.SelectHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]labels.Labels, error)
MetricsForLabelMatchersStream(ctx context.Context, from, through model.Time, hint *storage.SelectHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]labels.Labels, error)
MetricsMetadata(ctx context.Context, req *client.MetricsMetadataRequest) ([]scrape.MetricMetadata, error)
}

func newDistributorQueryable(distributor Distributor, streamingMetdata bool, labelNamesWithMatchers bool, iteratorFn chunkIteratorFunc, isPartialDataEnabled partialdata.IsCfgEnabledFunc, ingesterQueryMaxAttempts int, limits *validation.Overrides, nowFn func() time.Time) QueryableWithFilter {
func newDistributorQueryable(distributor Distributor, labelNamesWithMatchers bool, iteratorFn chunkIteratorFunc, isPartialDataEnabled partialdata.IsCfgEnabledFunc, ingesterQueryMaxAttempts int, limits *validation.Overrides, nowFn func() time.Time) QueryableWithFilter {
if nowFn == nil {
nowFn = time.Now
}
return distributorQueryable{
distributor: distributor,
streamingMetdata: streamingMetdata,
labelNamesWithMatchers: labelNamesWithMatchers,
iteratorFn: iteratorFn,
isPartialDataEnabled: isPartialDataEnabled,
Expand All @@ -61,7 +57,6 @@ func newDistributorQueryable(distributor Distributor, streamingMetdata bool, lab

type distributorQueryable struct {
distributor Distributor
streamingMetdata bool
labelNamesWithMatchers bool
iteratorFn chunkIteratorFunc
isPartialDataEnabled partialdata.IsCfgEnabledFunc
Expand All @@ -75,7 +70,6 @@ func (d distributorQueryable) Querier(mint, maxt int64) (storage.Querier, error)
distributor: d.distributor,
mint: mint,
maxt: maxt,
streamingMetadata: d.streamingMetdata,
labelNamesMatchers: d.labelNamesWithMatchers,
chunkIterFn: d.iteratorFn,
isPartialDataEnabled: d.isPartialDataEnabled,
Expand All @@ -93,7 +87,6 @@ func (d distributorQueryable) UseQueryable(now time.Time, userID string, _, quer
type distributorQuerier struct {
distributor Distributor
mint, maxt int64
streamingMetadata bool
labelNamesMatchers bool
chunkIterFn chunkIteratorFunc
isPartialDataEnabled partialdata.IsCfgEnabledFunc
Expand Down Expand Up @@ -142,16 +135,7 @@ func (q *distributorQuerier) Select(ctx context.Context, sortSeries bool, sp *st
// In the recent versions of Prometheus, we pass in the hint but with Func set to "series".
// See: https://github.com/prometheus/prometheus/pull/8050
if sp != nil && sp.Func == "series" {
var (
ms []labels.Labels
err error
)

if q.streamingMetadata {
ms, err = q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)
} else {
ms, err = q.distributor.MetricsForLabelMatchers(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)
}
ms, err := q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)

if err != nil && !partialdata.IsPartialDataError(err) {
return storage.ErrSeriesSet(err)
Expand Down Expand Up @@ -251,22 +235,11 @@ func (q *distributorQuerier) queryWithRetry(ctx context.Context, queryFunc func(
}

func (q *distributorQuerier) LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
var (
lvs []string
err error
)

partialDataEnabled := q.partialDataEnabled(ctx)

if q.streamingMetadata {
lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelValuesForLabelNameStream(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
})
} else {
lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelValuesForLabelName(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
})
}
lvs, err := q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelValuesForLabelNameStream(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
})

if partialdata.IsPartialDataError(err) {
warnings := annotations.Annotations(nil)
Expand All @@ -286,20 +259,9 @@ func (q *distributorQuerier) LabelNames(ctx context.Context, hints *storage.Labe
log, ctx := spanlogger.New(ctx, "distributorQuerier.LabelNames")
defer log.Finish()

var (
ln []string
err error
)

if q.streamingMetadata {
ln, err = q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
})
} else {
ln, err = q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelNames(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
})
}
ln, err := q.labelsWithRetry(ctx, func() ([]string, error) {
return q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
})

if partialdata.IsPartialDataError(err) {
warnings := annotations.Annotations(nil)
Expand Down Expand Up @@ -348,16 +310,7 @@ func (q *distributorQuerier) labelNamesWithMatchers(ctx context.Context, hints *
log, ctx := spanlogger.New(ctx, "distributorQuerier.labelNamesWithMatchers")
defer log.Finish()

var (
ms []labels.Labels
err error
)

if q.streamingMetadata {
ms, err = q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)
} else {
ms, err = q.distributor.MetricsForLabelMatchers(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)
}
ms, err := q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)

if err != nil && !partialdata.IsPartialDataError(err) {
return nil, nil, err
Expand Down
Loading