cmd: Make feature flag native-histograms a no-op.

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2025-11-13 16:07:21 +01:00
parent 4aa8941eb1
commit be4efd740c
4 changed files with 13 additions and 30 deletions

View File

@ -255,11 +255,7 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error {
parser.ExperimentalDurationExpr = true parser.ExperimentalDurationExpr = true
logger.Info("Experimental duration expression parsing enabled.") logger.Info("Experimental duration expression parsing enabled.")
case "native-histograms": case "native-histograms":
// Change relevant global variables. Hacky, but it's hard to pass a new option or default to unmarshallers. 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)
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)
case "ooo-native-histograms": case "ooo-native-histograms":
logger.Warn("This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", o) logger.Warn("This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", o)
case "created-timestamp-zero-ingestion": 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."). a.Flag("scrape.discovery-reload-interval", "Interval used by scrape manager to throttle target groups updates.").
Hidden().Default("5s").SetValue(&cfg.scrape.DiscoveryReloadInterval) 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) Default("").StringsVar(&cfg.featureList)
a.Flag("agent", "Run Prometheus in 'Agent mode'.").BoolVar(&agentMode) a.Flag("agent", "Run Prometheus in 'Agent mode'.").BoolVar(&agentMode)

View File

@ -58,7 +58,7 @@ The Prometheus monitoring server
| <code class="text-nowrap">--query.timeout</code> | Maximum time a query may take before being aborted. Use with server mode only. | `2m` | | <code class="text-nowrap">--query.timeout</code> | Maximum time a query may take before being aborted. Use with server mode only. | `2m` |
| <code class="text-nowrap">--query.max-concurrency</code> | Maximum number of queries executed concurrently. Use with server mode only. | `20` | | <code class="text-nowrap">--query.max-concurrency</code> | Maximum number of queries executed concurrently. Use with server mode only. | `20` |
| <code class="text-nowrap">--query.max-samples</code> | 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` | | <code class="text-nowrap">--query.max-samples</code> | 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` |
| <code class="text-nowrap">--enable-feature</code> <code class="text-nowrap">...<code class="text-nowrap"> | 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. | | | <code class="text-nowrap">--enable-feature</code> <code class="text-nowrap">...<code class="text-nowrap"> | 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. | |
| <code class="text-nowrap">--agent</code> | Run Prometheus in 'Agent mode'. | | | <code class="text-nowrap">--agent</code> | Run Prometheus in 'Agent mode'. | |
| <code class="text-nowrap">--log.level</code> | Only log messages with the given severity or above. One of: [debug, info, warn, error] | `info` | | <code class="text-nowrap">--log.level</code> | Only log messages with the given severity or above. One of: [debug, info, warn, error] | `info` |
| <code class="text-nowrap">--log.format</code> | Output format of log messages. One of: [logfmt, json] | `logfmt` | | <code class="text-nowrap">--log.format</code> | Output format of log messages. One of: [logfmt, json] | `logfmt` |

View File

@ -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 When disabled in either the engine or the query, per-step statistics are not
computed at all. 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 ## Experimental PromQL functions
`--enable-feature=promql-experimental-functions` `--enable-feature=promql-experimental-functions`

View File

@ -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 Prometheus v3 will log a warning if you continue to pass these to
`--enable-feature`. `--enable-feature`.
- Starting from Prometheus version v3.8, the feature flag `native-histograms` is - Starting from v3.9, the feature flag `native-histograms` is a no-op. Native
deprecated. Use the new `scrape_native_histograms` global and per-scrape histograms are a stable feature now, but scraping them has to be enabled via
configuration option instead. the `scrape_native_histograms` global or per-scrape configuration option
(added in v3.8).
## Configuration ## Configuration
- The scrape job level configuration option `scrape_classic_histograms` has been - The scrape job level configuration option `scrape_classic_histograms` has
renamed to `always_scrape_classic_histograms`. If you use the been renamed to `always_scrape_classic_histograms`. If you use the
`--enable-feature=native-histograms` feature flag to ingest native histograms `scrape_native_histograms` scrape configuration option to ingest native
and you also want to ingest classic histograms that an endpoint might expose histograms and you also want to ingest classic histograms that an endpoint
along with native histograms, be sure to add this configuration or change your might expose along with native histograms, be sure to add this configuration
configuration from the old name. or change your configuration from the old name.
- The `http_config.enable_http2` in `remote_write` items default has been - The `http_config.enable_http2` in `remote_write` items default has been
changed to `false`. In Prometheus v2 the remote write http client would changed to `false`. In Prometheus v2 the remote write http client would
default to use http2. In order to parallelize multiple remote write queues default to use http2. In order to parallelize multiple remote write queues