From c4875ec946eb183298b1f8e4f018d2044ebf4d5f Mon Sep 17 00:00:00 2001
From: dricoco <6524436+dricoco@users.noreply.github.com>
Date: Mon, 17 Oct 2022 09:05:14 +0200
Subject: [PATCH 1/3] adding the possibility to use http-request

adding the possibility to use http-request in stats to add prometheus exporter on metrics path
---
 templates/etc/haproxy/haproxy-stats.cfg.j2 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/templates/etc/haproxy/haproxy-stats.cfg.j2 b/templates/etc/haproxy/haproxy-stats.cfg.j2
index 88628ea..9bd95fa 100644
--- a/templates/etc/haproxy/haproxy-stats.cfg.j2
+++ b/templates/etc/haproxy/haproxy-stats.cfg.j2
@@ -27,6 +27,9 @@ listen stats
 {% for listener_opt in haproxy_stats_listener_options %}
     option     {{ listener_opt }}
 {% endfor %}
+{% for http_request in haproxy_stats_http_requests %}
+    http-request     {{ http_request }}
+{% endfor %}
 {% if haproxy_stats_timeouts is defined and haproxy_stats_timeouts|length %}
     {% for timeout in haproxy_stats_timeouts %}
     timeout    {{ timeout }}

From 0b7ef668f34934d5267f2f22f67978de517385f6 Mon Sep 17 00:00:00 2001
From: dricoco <6524436+dricoco@users.noreply.github.com>
Date: Mon, 17 Oct 2022 09:06:43 +0200
Subject: [PATCH 2/3] changing defaults for new option

---
 defaults/main.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/defaults/main.yml b/defaults/main.yml
index 6492fea..aac1aba 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -99,6 +99,7 @@ haproxy_stats_options:
   - show-node
   - hide-version
 haproxy_stats_listener_options: []
+haproxy_stats_http_requests: []
 haproxy_stats_timeouts:
   - client 100s
   - server 100s

From 2fc52cf0ae0e6bb5dc96e2bb1898715e09bc2212 Mon Sep 17 00:00:00 2001
From: dricoco <6524436+dricoco@users.noreply.github.com>
Date: Mon, 17 Oct 2022 09:08:57 +0200
Subject: [PATCH 3/3] update readme with option

---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 991e67b..88e23a4 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,8 @@ haproxy_stats_options:
   - show-legends
   - show-node
   - hide-version
+haproxy_stats_http_requests:
+  - use-service prometheus-exporter if { path /metrics }
 haproxy_stats_listener_options:
   - dontlog-normal
 haproxy_stats_timeouts: