BUILD: makefile: add a "USE_PROMEX" variable to ease building prometheus-exporter

The Prometheus exporter has gained in popularity and deserves to be easier
to build. Let's add a standard "USE_PROMEX" variable to enable it without
having to modify EXTRA_OBJS nor fiddling with the build path. The readme
was updated to reflect this.
This commit is contained in:
Willy Tarreau 2021-04-02 15:31:10 +02:00
parent a9f16c6495
commit 92dc78605a
2 changed files with 9 additions and 3 deletions

View File

@ -47,6 +47,7 @@
# USE_DL : enable it if your system requires -ldl. Automatic on Linux.
# USE_RT : enable it if your system requires -lrt. Automatic on Linux.
# USE_BACKTRACE : enable backtrace(). Automatic on Linux.
# USE_PROMEX : enable the Prometheus exporter
# USE_DEVICEATLAS : enable DeviceAtlas api.
# USE_51DEGREES : enable third party device detection library from 51Degrees
# USE_WURFL : enable WURFL detection library from Scientiamobile
@ -303,7 +304,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER \
USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS \
USE_DL USE_RT USE_DEVICEATLAS USE_51DEGREES USE_WURFL USE_SYSTEMD \
USE_OBSOLETE_LINKER USE_PRCTL USE_THREAD_DUMP USE_EVPORTS USE_OT \
USE_QUIC
USE_QUIC USE_PROMEX
#### Target system options
# Depending on the target platform, some options are set, as well as some
@ -615,6 +616,10 @@ endif
OPTIONS_OBJS += src/hlua.o src/hlua_fcn.o
endif
ifneq ($(USE_PROMEX),)
OPTIONS_OBJS += contrib/prometheus-exporter/service-prometheus.o
endif
ifneq ($(USE_DEVICEATLAS),)
# Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path
# to DeviceAtlas headers and libraries if needed.

View File

@ -12,9 +12,10 @@ HAProxy, like the stats applet.
However, PROMEX is not built by default with HAProxy. It is provided as an extra
component for everyone want to use it. So you need to explicitly build HAProxy
with the PROMEX service, using the Makefile variable "EXTRA_OBJS". For instance:
with the PROMEX service, setting the Makefile variable "USE_PROMEX" to "1". For
instance:
> make TARGET=linux-glibc EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"
> make TARGET=linux-glibc USE_PROMEX=1
if HAProxy provides the PROMEX service, the following build option will be
reported by the command "haproxy -vv":