mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-28 15:42:30 +00:00
MINOR: stats: Be able to access to registered stats modules from anywhere
The list of modules registered on the stats to expose extra counters is now public. It is required to export these counters into the Prometheus exporter.
This commit is contained in:
parent
42a97d9feb
commit
fd366a106b
@ -41,6 +41,7 @@ extern const struct name_desc stat_fields[];
|
||||
extern const struct name_desc info_fields[];
|
||||
extern const char *stat_status_codes[];
|
||||
extern struct applet http_stats_applet;
|
||||
extern struct list stats_module_list[];
|
||||
extern THREAD_LOCAL struct field info[];
|
||||
extern THREAD_LOCAL struct field *stat_l[];
|
||||
|
||||
@ -129,6 +130,16 @@ static inline struct field mkf_flt(uint32_t type, double value)
|
||||
#define MK_STATS_PROXY_DOMAIN(px_cap) \
|
||||
((px_cap) << STATS_PX_CAP | STATS_DOMAIN_PROXY)
|
||||
|
||||
static inline uint8_t stats_get_domain(uint32_t domain)
|
||||
{
|
||||
return domain >> STATS_DOMAIN & STATS_DOMAIN_MASK;
|
||||
}
|
||||
|
||||
static inline enum stats_domain_px_cap stats_px_get_cap(uint32_t domain)
|
||||
{
|
||||
return domain >> STATS_PX_CAP & STATS_PX_CAP_MASK;
|
||||
}
|
||||
|
||||
int stats_allocate_proxy_counters_internal(struct extra_counters **counters,
|
||||
int type, int px_cap);
|
||||
int stats_allocate_proxy_counters(struct proxy *px);
|
||||
|
12
src/stats.c
12
src/stats.c
@ -289,7 +289,7 @@ static size_t stat_count[STATS_DOMAIN_COUNT];
|
||||
THREAD_LOCAL struct field *stat_l[STATS_DOMAIN_COUNT];
|
||||
|
||||
/* list of all registered stats module */
|
||||
static struct list stats_module_list[STATS_DOMAIN_COUNT] = {
|
||||
struct list stats_module_list[STATS_DOMAIN_COUNT] = {
|
||||
LIST_HEAD_INIT(stats_module_list[STATS_DOMAIN_PROXY]),
|
||||
LIST_HEAD_INIT(stats_module_list[STATS_DOMAIN_RESOLVERS]),
|
||||
};
|
||||
@ -298,16 +298,6 @@ THREAD_LOCAL void *trash_counters;
|
||||
static THREAD_LOCAL struct buffer trash_chunk = BUF_NULL;
|
||||
|
||||
|
||||
static inline uint8_t stats_get_domain(uint32_t domain)
|
||||
{
|
||||
return domain >> STATS_DOMAIN & STATS_DOMAIN_MASK;
|
||||
}
|
||||
|
||||
static inline enum stats_domain_px_cap stats_px_get_cap(uint32_t domain)
|
||||
{
|
||||
return domain >> STATS_PX_CAP & STATS_PX_CAP_MASK;
|
||||
}
|
||||
|
||||
static void stats_dump_json_schema(struct buffer *out);
|
||||
|
||||
int stats_putchk(struct appctx *appctx, struct htx *htx)
|
||||
|
Loading…
Reference in New Issue
Block a user