From cdf018441947bf028d9ae5a4f0da8bade38842e3 Mon Sep 17 00:00:00 2001
From: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Date: Mon, 4 May 2026 15:14:31 +0200
Subject: [PATCH] Promote auto-reload-config stable
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
---
cmd/prometheus/main.go | 19 +++++++++++++------
cmd/prometheus/reload_test.go | 2 +-
docs/command-line/prometheus.md | 5 +++--
docs/feature_flags.md | 13 -------------
4 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go
index c731c95ed1..409b72f5f9 100644
--- a/cmd/prometheus/main.go
+++ b/cmd/prometheus/main.go
@@ -252,10 +252,7 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error {
logger.Info("Experimental per-step statistics reporting")
case "auto-reload-config":
c.enableAutoReload = true
- if s := time.Duration(c.autoReloadInterval).Seconds(); s > 0 && s < 1 {
- c.autoReloadInterval, _ = model.ParseDuration("1s")
- }
- logger.Info("Enabled automatic configuration file reloading. Checking for configuration changes every", "interval", c.autoReloadInterval)
+ logger.Warn("This option for --enable-feature is deprecated. Use --config.auto-reload instead.", "option", o)
case "concurrent-rule-eval":
c.enableConcurrentRuleEval = true
logger.Info("Experimental concurrent rule evaluation enabled.")
@@ -398,7 +395,10 @@ func main() {
a.Flag("config.file", "Prometheus configuration file path.").
Default("prometheus.yml").StringVar(&cfg.configFile)
- a.Flag("config.auto-reload-interval", "Specifies the interval for checking and automatically reloading the Prometheus configuration file upon detecting changes.").
+ a.Flag("config.auto-reload", "Enable automatic configuration file reloading. See also --config.auto-reload-interval.").
+ Default("false").BoolVar(&cfg.enableAutoReload)
+
+ a.Flag("config.auto-reload-interval", "Specifies the interval for checking and automatically reloading the Prometheus configuration file upon detecting changes. Only used when --config.auto-reload is set.").
Default("30s").SetValue(&cfg.autoReloadInterval)
a.Flag("web.listen-address", "Address to listen on for UI, API, and telemetry. Can be repeated.").
@@ -619,7 +619,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: auto-reload-config, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, extra-scrape-metrics, memory-snapshot-on-shutdown, metadata-wal-records, old-ui, otlp-deltatocumulative, otlp-native-delta-ingestion, promql-binop-fill-modifiers, promql-delayed-name-removal, promql-experimental-functions, promql-extended-range-selectors, promql-per-step-stats, st-storage, type-and-unit-labels, use-start-timestamps, use-uncached-io, xor2-encoding. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details.").
+ a.Flag("enable-feature", "Comma separated feature names to enable. Valid options: concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, extra-scrape-metrics, memory-snapshot-on-shutdown, metadata-wal-records, old-ui, otlp-deltatocumulative, otlp-native-delta-ingestion, promql-binop-fill-modifiers, promql-delayed-name-removal, promql-experimental-functions, promql-extended-range-selectors, promql-per-step-stats, st-storage, type-and-unit-labels, use-start-timestamps, use-uncached-io, xor2-encoding. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details.").
StringsVar(&cfg.featureList)
a.Flag("agent", "Run Prometheus in 'Agent mode'.").BoolVar(&agentMode)
@@ -655,6 +655,13 @@ func main() {
os.Exit(1)
}
+ if cfg.enableAutoReload {
+ if s := time.Duration(cfg.autoReloadInterval).Seconds(); s < 1 {
+ cfg.autoReloadInterval, _ = model.ParseDuration("1s")
+ }
+ logger.Info("Automatic configuration file reloading enabled", "interval", cfg.autoReloadInterval)
+ }
+
promqlParser := parser.NewParser(cfg.parserOpts)
if agentMode && len(serverOnlyFlags) > 0 {
diff --git a/cmd/prometheus/reload_test.go b/cmd/prometheus/reload_test.go
index 2841e23b36..1a75b410cf 100644
--- a/cmd/prometheus/reload_test.go
+++ b/cmd/prometheus/reload_test.go
@@ -119,7 +119,7 @@ func runTestSteps(t *testing.T, steps []struct {
require.NoError(t, os.WriteFile(configFilePath, []byte(steps[0].configText), 0o644), "Failed to write initial config file")
port := testutil.RandomUnprivilegedPort(t)
- prom := prometheusCommandWithLogging(t, configFilePath, port, "--enable-feature=auto-reload-config", "--config.auto-reload-interval=1s")
+ prom := prometheusCommandWithLogging(t, configFilePath, port, "--config.auto-reload", "--config.auto-reload-interval=1s")
require.NoError(t, prom.Start())
baseURL := "http://localhost:" + strconv.Itoa(port)
diff --git a/docs/command-line/prometheus.md b/docs/command-line/prometheus.md
index 77e519ff94..e21c4c2a67 100644
--- a/docs/command-line/prometheus.md
+++ b/docs/command-line/prometheus.md
@@ -12,7 +12,8 @@ The Prometheus monitoring server
| -h, --help | Show context-sensitive help (also try --help-long and --help-man). | |
| --version | Show application version. | |
| --config.file | Prometheus configuration file path. | `prometheus.yml` |
-| --config.auto-reload-interval | Specifies the interval for checking and automatically reloading the Prometheus configuration file upon detecting changes. | `30s` |
+| --config.auto-reload | Enable automatic configuration file reloading. See also --config.auto-reload-interval. | `false` |
+| --config.auto-reload-interval | Specifies the interval for checking and automatically reloading the Prometheus configuration file upon detecting changes. Only used when --config.auto-reload is set. | `30s` |
| --web.listen-address ... | Address to listen on for UI, API, and telemetry. Can be repeated. | `0.0.0.0:9090` |
| --auto-gomaxprocs | Automatically set GOMAXPROCS to match Linux container CPU quota | `true` |
| --auto-gomemlimit | Automatically set GOMEMLIMIT to match Linux container or system memory limit | `true` |
@@ -61,7 +62,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: auto-reload-config, concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, extra-scrape-metrics, memory-snapshot-on-shutdown, metadata-wal-records, old-ui, otlp-deltatocumulative, otlp-native-delta-ingestion, promql-binop-fill-modifiers, promql-delayed-name-removal, promql-experimental-functions, promql-extended-range-selectors, promql-per-step-stats, st-storage, type-and-unit-labels, use-start-timestamps, use-uncached-io, xor2-encoding. See https://prometheus.io/docs/prometheus/latest/feature_flags/ for more details. | |
+| --enable-feature ... | Comma separated feature names to enable. Valid options: concurrent-rule-eval, created-timestamp-zero-ingestion, delayed-compaction, exemplar-storage, extra-scrape-metrics, memory-snapshot-on-shutdown, metadata-wal-records, old-ui, otlp-deltatocumulative, otlp-native-delta-ingestion, promql-binop-fill-modifiers, promql-delayed-name-removal, promql-experimental-functions, promql-extended-range-selectors, promql-per-step-stats, st-storage, type-and-unit-labels, use-start-timestamps, use-uncached-io, xor2-encoding. 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 0538e9ca48..fddb4dcf6b 100644
--- a/docs/feature_flags.md
+++ b/docs/feature_flags.md
@@ -170,19 +170,6 @@ fixes the possible problem with the feature flag.)
It is possible to craft a query that aggregates by `__name__` and puts samples with and without delayed name removal into the same group. In that case, the name is removed from the affected group. Note that this case hardly occurs in queries that fulfill a practical purpose.
-## Auto Reload Config
-
-`--enable-feature=auto-reload-config`
-
-When enabled, Prometheus will automatically reload its configuration file at a
-specified interval. The interval is defined by the
-`--config.auto-reload-interval` flag, which defaults to `30s`.
-
-Configuration reloads are triggered by detecting changes in the checksum of the
-main configuration file or any referenced files, such as rule and scrape
-configurations. To ensure consistency and avoid issues during reloads, it's
-recommended to update these files atomically.
-
## OTLP Delta Conversion
`--enable-feature=otlp-deltatocumulative`