MINOR: contrib/prometheus-exporter: Add promex_metric struct defining a metric

This structure will be used to define a Prometheus metric, i.e its name, its
type (gauge or counter) and its flags. The flags will be used to know for
which entities the metric is defined (global, frontend, backend and/or server).
This commit is contained in:
Christopher Faulet 2021-01-20 15:19:12 +01:00
parent b713c4f295
commit 0312c0d192
1 changed files with 13 additions and 0 deletions

View File

@ -74,6 +74,12 @@ enum {
#define PROMEX_FL_SCOPE_ALL (PROMEX_FL_SCOPE_GLOBAL|PROMEX_FL_SCOPE_FRONT|PROMEX_FL_SCOPE_BACK|PROMEX_FL_SCOPE_SERVER)
/* Promtheus metric type (gauge or counter) */
enum promex_mt_type {
PROMEX_MT_GAUGE = 1,
PROMEX_MT_COUNTER = 2,
};
/* The max length for metrics name. It is a hard limit but it should be
* enough.
*/
@ -89,6 +95,13 @@ enum {
#define PROMEX_VERSION_LABEL "version=\"" HAPROXY_VERSION "\""
#define PROMEX_BUILDINFO_LABEL PROMEX_VERSION_LABEL
/* Describe a prometheus metric */
struct promex_metric {
const struct ist n; /* The metric name */
enum promex_mt_type type; /* The metric type (gauge or counter) */
unsigned int flags; /* PROMEX_FL_* flags */
};
/* Matrix used to dump global metrics. Each metric points to the next one to be
* processed or 0 to stop the dump. */
const int promex_global_metrics[INF_TOTAL_FIELDS] = {