]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: promex: Add a registration mechanism to support modules
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 30 Jan 2024 06:34:54 +0000 (07:34 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 2 Feb 2024 08:11:24 +0000 (09:11 +0100)
commiteb2128723aabdc94f0a59a087229e5c674336b2e
treeed0f4a7a207571a0fc2bfd992972f2cf4a8efd82
parent65db9f2a01a2893cbf5060a8a15e41c2266a7b45
MEDIUM: promex: Add a registration mechanism to support modules

In this patch we add a registration mechanism for modules. To do so, a
module must defined the "promex_module" structure. The dump itself will be
based on 2 contexts. One for all the dump and another one for each metric
time-series. These contexts are used as restart points when the dump is
interrupted.

Modules must also implement 6 callback functions:

  * start_metric_dump(): It is an optional callback function. If defined, it
                         is responsible to initialize the dump context use
                         as the first restart point.

  * stop_metric_dump(): It is an optional callback function. If defined, it
                        is responsible to deinit the dump context.

  * metric_info(): This one is mandatory. It returns the info about the
                   metric: name, type and flags and descrition.

  * start_ts(): This one is mandatory, it initializes the context for a time
                series for a given metric. This context is the second
                restart point.

  * next_ts(): This one is mandatory. It interates on time series for a
               given metrics. It is also responsible to handle end of a
               time series and deinit the context.

  * fill_ts(): It fills info on the time series for a given metric : the
               labels and the value.

In addition, a module must set its name and declare the number of metrics is
exposed.
Makefile
addons/promex/include/promex/promex.h [new file with mode: 0644]
addons/promex/service-prometheus.c