Skip to content

Commit 5a2456e

Browse files
committed
Remove the deprecated fifocache.size and querier.ingester-metadata-streaming settings
Unlike the flag-only removals, both of these have a YAML config option and one of them changes behaviour, so they are split out here. -<prefix>.fifocache.size was deprecated in 1.1.0, five years and twenty-one minors ago. A cache configured only through it now starts with no capacity, because NewFifoCache no longer copies it into MaxSizeItems. -querier.ingester-metadata-streaming defaulted to true and its help text has promised since 1.18.0 that the feature would be always on. The querier now always uses the streaming metadata RPCs, so the non-streaming branches in distributor_queryable.go and the three non-streaming methods on the local Distributor interface are gone. The tests that parameterised over streaming on/off collapse accordingly. Also removes the hidden ingester_streaming YAML field, which had no reader at all - it was left behind when -querier.ingester-streaming was deprecated in 1.17.0. Because Cortex decodes config with UnmarshalStrict, that field was still silently accepted until now. Generated config docs and the JSON schema are regenerated. Signed-off-by: Charlie Le <charlie_le@apple.com>
1 parent f551242 commit 5a2456e

9 files changed

Lines changed: 250 additions & 355 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## master / unreleased
44
* [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
5+
* [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
6+
* [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
57
* [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
68
- `-querier.ingester-streaming` (deprecated in 1.17.0)
79
- `-querier.iterators` (deprecated in 1.17.0)

docs/blocks-storage/querier.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ querier:
104104
# CLI flag: -querier.timeout
105105
[timeout: <duration> | default = 2m]
106106

107-
# Deprecated (This feature will be always on after v1.18): Use streaming RPCs
108-
# for metadata APIs from ingester.
109-
# CLI flag: -querier.ingester-metadata-streaming
110-
[ingester_metadata_streaming: <boolean> | default = true]
111-
112107
# Use LabelNames ingester RPCs with match params.
113108
# CLI flag: -querier.ingester-label-names-with-matchers
114109
[ingester_label_names_with_matchers: <boolean> | default = false]

docs/configuration/config-file-reference.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,11 +3844,6 @@ The `fifo_cache_config` configures the local in-memory cache.
38443844
# The expiry duration for the cache.
38453845
# CLI flag: -frontend.fifocache.duration
38463846
[validity: <duration> | default = 0s]
3847-
3848-
# Deprecated (use max-size-items or max-size-bytes instead): The number of
3849-
# entries to cache.
3850-
# CLI flag: -frontend.fifocache.size
3851-
[size: <int> | default = 0]
38523847
```
38533848

38543849
### `flusher_config`
@@ -5274,11 +5269,6 @@ The `querier_config` configures the Cortex querier.
52745269
# CLI flag: -querier.timeout
52755270
[timeout: <duration> | default = 2m]
52765271
5277-
# Deprecated (This feature will be always on after v1.18): Use streaming RPCs
5278-
# for metadata APIs from ingester.
5279-
# CLI flag: -querier.ingester-metadata-streaming
5280-
[ingester_metadata_streaming: <boolean> | default = true]
5281-
52825272
# Use LabelNames ingester RPCs with match params.
52835273
# CLI flag: -querier.ingester-label-names-with-matchers
52845274
[ingester_label_names_with_matchers: <boolean> | default = false]

pkg/chunk/cache/fifo_cache.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
"github.com/pkg/errors"
1515
"github.com/prometheus/client_golang/prometheus"
1616
"github.com/prometheus/client_golang/prometheus/promauto"
17-
18-
"github.com/cortexproject/cortex/pkg/util/flagext"
1917
)
2018

2119
const (
@@ -33,17 +31,13 @@ type FifoCacheConfig struct {
3331
MaxSizeBytes string `yaml:"max_size_bytes"`
3432
MaxSizeItems int `yaml:"max_size_items"`
3533
Validity time.Duration `yaml:"validity"`
36-
37-
DeprecatedSize int `yaml:"size"`
3834
}
3935

4036
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
4137
func (cfg *FifoCacheConfig) RegisterFlagsWithPrefix(prefix, description string, f *flag.FlagSet) {
4238
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.")
4339
f.IntVar(&cfg.MaxSizeItems, prefix+"fifocache.max-size-items", 0, description+"Maximum number of entries in the cache.")
4440
f.DurationVar(&cfg.Validity, prefix+"fifocache.duration", 0, description+"The expiry duration for the cache.")
45-
46-
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. ")
4741
}
4842

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

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

10392
if maxSizeBytes == 0 && cfg.MaxSizeItems == 0 {

pkg/querier/distributor_queryable.go

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,18 @@ const retryMaxBackoff = 5 * time.Millisecond
3434
type Distributor interface {
3535
QueryStream(ctx context.Context, from, to model.Time, partialDataEnabled bool, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error)
3636
QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error)
37-
LabelValuesForLabelName(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error)
3837
LabelValuesForLabelNameStream(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]string, error)
39-
LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints, bool, ...*labels.Matcher) ([]string, error)
4038
LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints, bool, ...*labels.Matcher) ([]string, error)
41-
MetricsForLabelMatchers(ctx context.Context, from, through model.Time, hint *storage.SelectHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]labels.Labels, error)
4239
MetricsForLabelMatchersStream(ctx context.Context, from, through model.Time, hint *storage.SelectHints, partialDataEnabled bool, matchers ...*labels.Matcher) ([]labels.Labels, error)
4340
MetricsMetadata(ctx context.Context, req *client.MetricsMetadataRequest) ([]scrape.MetricMetadata, error)
4441
}
4542

46-
func newDistributorQueryable(distributor Distributor, streamingMetdata bool, labelNamesWithMatchers bool, iteratorFn chunkIteratorFunc, isPartialDataEnabled partialdata.IsCfgEnabledFunc, ingesterQueryMaxAttempts int, limits *validation.Overrides, nowFn func() time.Time) QueryableWithFilter {
43+
func newDistributorQueryable(distributor Distributor, labelNamesWithMatchers bool, iteratorFn chunkIteratorFunc, isPartialDataEnabled partialdata.IsCfgEnabledFunc, ingesterQueryMaxAttempts int, limits *validation.Overrides, nowFn func() time.Time) QueryableWithFilter {
4744
if nowFn == nil {
4845
nowFn = time.Now
4946
}
5047
return distributorQueryable{
5148
distributor: distributor,
52-
streamingMetdata: streamingMetdata,
5349
labelNamesWithMatchers: labelNamesWithMatchers,
5450
iteratorFn: iteratorFn,
5551
isPartialDataEnabled: isPartialDataEnabled,
@@ -61,7 +57,6 @@ func newDistributorQueryable(distributor Distributor, streamingMetdata bool, lab
6157

6258
type distributorQueryable struct {
6359
distributor Distributor
64-
streamingMetdata bool
6560
labelNamesWithMatchers bool
6661
iteratorFn chunkIteratorFunc
6762
isPartialDataEnabled partialdata.IsCfgEnabledFunc
@@ -75,7 +70,6 @@ func (d distributorQueryable) Querier(mint, maxt int64) (storage.Querier, error)
7570
distributor: d.distributor,
7671
mint: mint,
7772
maxt: maxt,
78-
streamingMetadata: d.streamingMetdata,
7973
labelNamesMatchers: d.labelNamesWithMatchers,
8074
chunkIterFn: d.iteratorFn,
8175
isPartialDataEnabled: d.isPartialDataEnabled,
@@ -93,7 +87,6 @@ func (d distributorQueryable) UseQueryable(now time.Time, userID string, _, quer
9387
type distributorQuerier struct {
9488
distributor Distributor
9589
mint, maxt int64
96-
streamingMetadata bool
9790
labelNamesMatchers bool
9891
chunkIterFn chunkIteratorFunc
9992
isPartialDataEnabled partialdata.IsCfgEnabledFunc
@@ -142,16 +135,7 @@ func (q *distributorQuerier) Select(ctx context.Context, sortSeries bool, sp *st
142135
// In the recent versions of Prometheus, we pass in the hint but with Func set to "series".
143136
// See: https://github.com/prometheus/prometheus/pull/8050
144137
if sp != nil && sp.Func == "series" {
145-
var (
146-
ms []labels.Labels
147-
err error
148-
)
149-
150-
if q.streamingMetadata {
151-
ms, err = q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)
152-
} else {
153-
ms, err = q.distributor.MetricsForLabelMatchers(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)
154-
}
138+
ms, err := q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(minT), model.Time(maxT), sp, partialDataEnabled, matchers...)
155139

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

253237
func (q *distributorQuerier) LabelValues(ctx context.Context, name string, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) {
254-
var (
255-
lvs []string
256-
err error
257-
)
258-
259238
partialDataEnabled := q.partialDataEnabled(ctx)
260239

261-
if q.streamingMetadata {
262-
lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
263-
return q.distributor.LabelValuesForLabelNameStream(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
264-
})
265-
} else {
266-
lvs, err = q.labelsWithRetry(ctx, func() ([]string, error) {
267-
return q.distributor.LabelValuesForLabelName(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
268-
})
269-
}
240+
lvs, err := q.labelsWithRetry(ctx, func() ([]string, error) {
241+
return q.distributor.LabelValuesForLabelNameStream(ctx, model.Time(q.mint), model.Time(q.maxt), model.LabelName(name), hints, partialDataEnabled, matchers...)
242+
})
270243

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

289-
var (
290-
ln []string
291-
err error
292-
)
293-
294-
if q.streamingMetadata {
295-
ln, err = q.labelsWithRetry(ctx, func() ([]string, error) {
296-
return q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
297-
})
298-
} else {
299-
ln, err = q.labelsWithRetry(ctx, func() ([]string, error) {
300-
return q.distributor.LabelNames(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
301-
})
302-
}
262+
ln, err := q.labelsWithRetry(ctx, func() ([]string, error) {
263+
return q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, partialDataEnabled, matchers...)
264+
})
303265

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

351-
var (
352-
ms []labels.Labels
353-
err error
354-
)
355-
356-
if q.streamingMetadata {
357-
ms, err = q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)
358-
} else {
359-
ms, err = q.distributor.MetricsForLabelMatchers(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)
360-
}
313+
ms, err := q.distributor.MetricsForLabelMatchersStream(ctx, model.Time(q.mint), model.Time(q.maxt), labelHintsToSelectHints(hints), partialDataEnabled, matchers...)
361314

362315
if err != nil && !partialdata.IsPartialDataError(err) {
363316
return nil, nil, err

0 commit comments

Comments
 (0)