From be4efd740c5833bb34d03b8b2f2e549f236fb71c Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 13 Nov 2025 16:07:21 +0100 Subject: [PATCH] cmd: Make feature flag `native-histograms` a no-op. Signed-off-by: beorn7 --- cmd/prometheus/main.go | 8 ++------ docs/command-line/prometheus.md | 2 +- docs/feature_flags.md | 14 -------------- docs/migration.md | 19 ++++++++++--------- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 75b268322a..6ea65c879a 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -255,11 +255,7 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error { parser.ExperimentalDurationExpr = true logger.Info("Experimental duration expression parsing enabled.") case "native-histograms": - // Change relevant global variables. Hacky, but it's hard to pass a new option or default to unmarshallers. - t := true - config.DefaultConfig.GlobalConfig.ScrapeNativeHistograms = &t - config.DefaultGlobalConfig.ScrapeNativeHistograms = &t - logger.Warn("This option for --enable-feature is being phased out. It currently changes the default for the scrape_native_histograms scrape config setting to true, but will become a no-op in v3.9+. Stop using this option and set scrape_native_histograms in the scrape config instead.", "option", o) + logger.Warn("This option for --enable-feature is a no-op. To scrape native histograms, set the scrape_native_histograms scrape config setting to true.", "option", o) case "ooo-native-histograms": logger.Warn("This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", o) case "created-timestamp-zero-ingestion": @@ -564,7 +560,7 @@ func main() { a.Flag("scrape.discovery-reload-interval", "Interval used by scrape manager to throttle target groups updates."). Hidden().Default("5s").SetValue(&cfg.scrape.DiscoveryReloadInterval) - a.Flag("enable-feature", "Comma separated feature names to enable. Valid options: exemplar-storage, expand-external-labels, memory-snapshot-on-shutdown, promql-per-step-stats, promql-experimental-functions, extra-scrape-metrics, auto-gomaxprocs, native-histograms, created-timestamp-zero-ingestion, concurrent-rule-eval, delayed-compaction, old-ui, otlp-deltatocumulative, promql-duration-expr, use-uncached-io, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details."). + a.Flag("enable-feature", "Comma separated feature names to enable. Valid options: exemplar-storage, expand-external-labels, memory-snapshot-on-shutdown, promql-per-step-stats, promql-experimental-functions, extra-scrape-metrics, auto-gomaxprocs, created-timestamp-zero-ingestion, concurrent-rule-eval, delayed-compaction, old-ui, otlp-deltatocumulative, promql-duration-expr, use-uncached-io, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details."). Default("").StringsVar(&cfg.featureList) a.Flag("agent", "Run Prometheus in 'Agent mode'.").BoolVar(&agentMode) diff --git a/docs/command-line/prometheus.md b/docs/command-line/prometheus.md index 0396f90bee..c79dad40a2 100644 --- a/docs/command-line/prometheus.md +++ b/docs/command-line/prometheus.md @@ -58,7 +58,7 @@ The Prometheus monitoring server | --query.timeout | Maximum time a query may take before being aborted. Use with server mode only. | `2m` | | --query.max-concurrency | Maximum number of queries executed concurrently. Use with server mode only. | `20` | | --query.max-samples | Maximum number of samples a single query can load into memory. Note that queries will fail if they try to load more samples than this into memory, so this also limits the number of samples a query can return. Use with server mode only. | `50000000` | -| --enable-feature ... | Comma separated feature names to enable. Valid options: exemplar-storage, expand-external-labels, memory-snapshot-on-shutdown, promql-per-step-stats, promql-experimental-functions, extra-scrape-metrics, auto-gomaxprocs, native-histograms, created-timestamp-zero-ingestion, concurrent-rule-eval, delayed-compaction, old-ui, otlp-deltatocumulative, promql-duration-expr, use-uncached-io, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | | +| --enable-feature ... | Comma separated feature names to enable. Valid options: exemplar-storage, expand-external-labels, memory-snapshot-on-shutdown, promql-per-step-stats, promql-experimental-functions, extra-scrape-metrics, auto-gomaxprocs, created-timestamp-zero-ingestion, concurrent-rule-eval, delayed-compaction, old-ui, otlp-deltatocumulative, promql-duration-expr, use-uncached-io, promql-extended-range-selectors. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | | | --agent | Run Prometheus in 'Agent mode'. | | | --log.level | Only log messages with the given severity or above. One of: [debug, info, warn, error] | `info` | | --log.format | Output format of log messages. One of: [logfmt, json] | `logfmt` | diff --git a/docs/feature_flags.md b/docs/feature_flags.md index f9f27bfb7f..0051859d66 100644 --- a/docs/feature_flags.md +++ b/docs/feature_flags.md @@ -45,20 +45,6 @@ statistics. Currently this is limited to totalQueryableSamples. When disabled in either the engine or the query, per-step statistics are not computed at all. -## Native Histograms - -`--enable-feature=native-histograms` - -_This feature flag is being phased out. You should not use it anymore._ - -Native histograms are a stable feature by now. However, to scrape native -histograms, a scrape config setting `scrape_native_histograms` is required. To -ease the transition, this feature flag sets the default value of -`scrape_native_histograms` to `true`. From v3.9 on, this feature flag will be a -true no-op, and the default value of `scrape_native_histograms` will be always -`false`. If you are still using this feature flag while running v3.8, update -your scrape configs and stop using the feature flag before upgrading to v3.9. - ## Experimental PromQL functions `--enable-feature=promql-experimental-functions` diff --git a/docs/migration.md b/docs/migration.md index 78db5b7d0f..6a08373f5c 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -43,18 +43,19 @@ This document offers guidance on migrating from Prometheus 2.x to Prometheus 3.0 Prometheus v3 will log a warning if you continue to pass these to `--enable-feature`. -- Starting from Prometheus version v3.8, the feature flag `native-histograms` is - deprecated. Use the new `scrape_native_histograms` global and per-scrape - configuration option instead. +- Starting from v3.9, the feature flag `native-histograms` is a no-op. Native + histograms are a stable feature now, but scraping them has to be enabled via + the `scrape_native_histograms` global or per-scrape configuration option + (added in v3.8). ## Configuration -- The scrape job level configuration option `scrape_classic_histograms` has been - renamed to `always_scrape_classic_histograms`. If you use the - `--enable-feature=native-histograms` feature flag to ingest native histograms - and you also want to ingest classic histograms that an endpoint might expose - along with native histograms, be sure to add this configuration or change your - configuration from the old name. +- The scrape job level configuration option `scrape_classic_histograms` has + been renamed to `always_scrape_classic_histograms`. If you use the + `scrape_native_histograms` scrape configuration option to ingest native + histograms and you also want to ingest classic histograms that an endpoint + might expose along with native histograms, be sure to add this configuration + or change your configuration from the old name. - The `http_config.enable_http2` in `remote_write` items default has been changed to `false`. In Prometheus v2 the remote write http client would default to use http2. In order to parallelize multiple remote write queues