Skip to content

fix: Prometheus Metrics endpoint is always enabled because ha_proxy.stats_promex_enable is not checked properly#901

Open
a18e wants to merge 1 commit intomasterfrom
fix-stats_promex_enable
Open

fix: Prometheus Metrics endpoint is always enabled because ha_proxy.stats_promex_enable is not checked properly#901
a18e wants to merge 1 commit intomasterfrom
fix-stats_promex_enable

Conversation

@a18e
Copy link
Copy Markdown
Contributor

@a18e a18e commented Apr 21, 2026

  • if_p yields whenever a property has any value, including spec defaults — it does not check the boolean value
  • ha_proxy.stats_promex_enable has default: false in the spec, so if_p was always yielding and the prometheus-exporter line was always written to the rendered config, even when the property was never set by the operator
  • Fix: replace if_p(...) with if p(...) so the boolean is actually evaluated

This has been the case since the feature was introduced in #536 so the prometheus metrics endpoint is currently active everywhere. Merging this PR would fix this but potentially break scenarios where people rely on it but haven't set the flag to true.

…rter

if_p yields whenever a property has any value (including spec defaults),
so the prometheus-exporter line was always emitted regardless of the
property's boolean value. Switch to if p(...) to evaluate the boolean.
@a18e a18e changed the title Fix: stats_promex_enable default renders prometheus-exporter unconditionally fix: Prometheus Metrics endpoint is always enabled because ha_proxy.stats_promex_enable is not checked properly Apr 21, 2026
@a18e a18e marked this pull request as ready for review April 21, 2026 13:59
@a18e a18e requested review from a team and CFN-CI as code owners April 21, 2026 13:59
Copy link
Copy Markdown
Contributor

@hoffmaen hoffmaen left a comment

Choose a reason for hiding this comment

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

Have you checked if the wrong use of if_p is also present in other places?

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Apr 21, 2026
Copy link
Copy Markdown
Contributor

@hoffmaen hoffmaen left a comment

Choose a reason for hiding this comment

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

I've been poking around the code a bit, there is one more boolean property that suffers from the same bug: reload_idle_close_on_response.

Since it defaults to true, setting it to false still enters the if_p block and enables idle-close-on-response. Can you fix that too with this PR?

@hoffmaen hoffmaen requested review from hoffmaen and removed request for hoffmaen April 23, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

2 participants