MEDIUM: stats: integrate static proxies stats in new stats

This is executed on startup with the registered statistics module. The
existing statistics have been merged in a list containing all
statistics for each domain. This is useful to print all available
statistics in a generic way.

Allocate extra counters for all proxies/servers/listeners instances.
These counters are allocated with the counters from the stats modules
registered on startup.
This commit is contained in:
Amaury Denoyelle
2020-10-05 11:49:42 +02:00
committed by Christopher Faulet
parent 730c727ea3
commit ee63d4bd67
6 changed files with 242 additions and 24 deletions

View File

@@ -30,7 +30,8 @@
#include <haproxy/api-t.h>
#include <haproxy/obj_type-t.h>
#include <haproxy/receiver-t.h>
#include <haproxy/thread-t.h>
#include <haproxy/stats-t.h>
#include <haproxy/thread.h>
#ifdef USE_OPENSSL
#include <haproxy/openssl-compat.h>
@@ -221,6 +222,8 @@ struct listener {
struct {
struct eb32_node id; /* place in the tree of used IDs */
} conf; /* config information */
EXTRA_COUNTERS(extra_counters);
};
/* Descriptor for a "bind" keyword. The ->parse() function returns 0 in case of

View File

@@ -37,6 +37,7 @@
#include <haproxy/freq_ctr-t.h>
#include <haproxy/obj_type-t.h>
#include <haproxy/server-t.h>
#include <haproxy/stats-t.h>
#include <haproxy/tcpcheck-t.h>
#include <haproxy/thread-t.h>
#include <haproxy/uri_auth-t.h>
@@ -451,6 +452,9 @@ struct proxy {
*/
struct list filter_configs; /* list of the filters that are declared on this proxy */
__decl_thread(HA_SPINLOCK_T lock); /* may be taken under the server's lock */
EXTRA_COUNTERS(extra_counters_fe);
EXTRA_COUNTERS(extra_counters_be);
};
struct switching_rule {

View File

@@ -38,6 +38,7 @@
#include <haproxy/obj_type-t.h>
#include <haproxy/openssl-compat.h>
#include <haproxy/ssl_sock-t.h>
#include <haproxy/stats-t.h>
#include <haproxy/task-t.h>
#include <haproxy/thread-t.h>
@@ -352,6 +353,8 @@ struct server {
char adm_st_chg_cause[48]; /* administrative status change's cause */
struct sockaddr_storage socks4_addr; /* the address of the SOCKS4 Proxy, including the port */
EXTRA_COUNTERS(extra_counters);
};

View File

@@ -123,6 +123,8 @@ 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)
int stats_allocate_proxy_counters(struct proxy *px);
void stats_register_module(struct stats_module *m);
#endif /* _HAPROXY_STATS_H */