Skip to content

Commit 25b0592

Browse files
committed
MINOR: promex: Add global and proxies description as labels to all metrics
While the global description is exposed, when defined, in a dedicated metric, it is not possible to dump the description defined in a frontend/listen/backend sections. So, thanks to this patch, it is now possible to dump it as a label of all metrics of the corresponding section. To do so, "desc-labels" parameter must be provided on the URL: /metrics?desc-labels When this parameter is set, if a description is provided in a section, including the global one, the "desc" label will be added to all metrics of this section. For instance: haproxy_frontend_current_sessions{proxy="front-http",desc="..."} 1 Note that servers metrics inherit the description of their backend/listen section. This patch should solve the issue #1531.
1 parent 451d216 commit 25b0592

File tree

3 files changed

+149
-58
lines changed

3 files changed

+149
-58
lines changed

addons/promex/README

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ name must be preceded by a minus character ('-'). Here are examples:
9191
# Only dump frontends, backends and servers status
9292
/metrics?metrics=haproxy_frontend_status,haproxy_backend_status,haproxy_server_status
9393

94+
* Add section description as label for all metrics
95+
96+
It is possible to set a description in global and proxy sections, via the
97+
"description" directive. The global descrption is exposed if it is define via
98+
the "haproxy_process_description" metric. But the descriptions provided in proxy
99+
sections are not dumped. However, it is possible to add it as a label for all
100+
metrics of the corresponding section, including the global one. To do so,
101+
"desc-labels" parameter must be set:
102+
103+
/metrics?desc-labels
104+
105+
/ metrics?scope=frontend&desc-labels
94106

95107
* Dump extra counters
96108

addons/promex/include/promex/promex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define PROMEX_FL_NO_MAINT_SRV 0x00002000
4848
#define PROMEX_FL_EXTRA_COUNTERS 0x00004000
4949
#define PROMEX_FL_INC_METRIC_BY_DEFAULT 0x00008000
50+
#define PROMEX_FL_DESC_LABELS 0x00010000
5051

5152
#define PROMEX_FL_SCOPE_ALL (PROMEX_FL_SCOPE_GLOBAL | PROMEX_FL_SCOPE_FRONT | \
5253
PROMEX_FL_SCOPE_LI | PROMEX_FL_SCOPE_BACK | \

0 commit comments

Comments
 (0)