Skip to content

test(cmd/prometheus): add TestFeatureFlagsDocumented and adjust --enable-feature description#18487

Open
machine424 wants to merge 1 commit intoprometheus:mainfrom
machine424:featufl
Open

test(cmd/prometheus): add TestFeatureFlagsDocumented and adjust --enable-feature description#18487
machine424 wants to merge 1 commit intoprometheus:mainfrom
machine424:featufl

Conversation

@machine424
Copy link
Copy Markdown
Member

Add TestFeatureFlagsDocumented to ensure the --enable-feature help text in and docs/feature_flags.md list the same set of flags.

The help text was out of sync with the documentation:

  • Flags present in docs but missing from help text: auto-reload-config, metadata-wal-records, otlp-native-delta-ingestion, promql-delayed-name-removal, type-and-unit-labels. Added them.
  • Flags present in help text but missing from docs: auto-gomaxprocs, expand-external-labels. Removed them.

The help text is now sorted for better readability and kept in sync with the documentation.

Also, the parsing of an empty --enable-feature was changed to print msg="Unknown option for --enable-feature" option="" instead of nothing.

Which issue(s) does the PR fix:

Release notes for end users (ALL commits must be considered).

Reviewers should verify clarity and quality.

[BUGFIX]: Config: Update `--enable-feature`  flag description and sort feature names.

@machine424 machine424 requested a review from a team as a code owner April 8, 2026 18:34
@machine424 machine424 requested a review from codesome April 8, 2026 18:34
@machine424 machine424 changed the title test(cmd/prometheus): add TestFeatureFlagsDocumented and fix help text test(cmd/prometheus): add TestFeatureFlagsDocumented and adjust --enable-feature description Apr 8, 2026
Add TestFeatureFlagsDocumented to ensure the --enable-feature help text
in and docs/feature_flags.md list the same set of flags.

The help text was out of sync with the documentation:
- Flags present in docs but missing from help text: `auto-reload-config`,
  `metadata-wal-records`, `otlp-native-delta-ingestion`,
  `promql-delayed-name-removal`, `type-and-unit-labels`. Added them.
- Flags present in help text but missing from docs: `auto-gomaxprocs`,
  `expand-external-labels`. Removed them.

The help text is now sorted for better readability and kept in sync
with the documentation.

Also, the parsing of an empty `--enable-feature` was changed to
print `msg="Unknown option for --enable-feature" option=""` instead of nothing.

Signed-off-by: Ayoub Mrini <[email protected]>
Comment thread cmd/prometheus/main.go
c.parserOpts.EnableBinopFillModifiers = true
logger.Info("Experimental PromQL binary operator fill modifiers enabled.")
case "":
continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still allow that, following the robustness principle.

}, 30*time.Second, time.Second)
}

// TestFeatureFlagsDocumented ensures the --enable-feature help text in main.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have this test in docs?

using statically https://github.com/prometheus/prometheus/blob/main/docs/command-line/prometheus.md

I think it would be lighter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants