mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: stats: add 3 fields to report the frontend-specific connection stats
Frontends have extra information compared to other entities, they can report some statistics at the connection level while the other ones are limited to the session level. This patch adds 3 more fields for this : - conn_rate - conn_rate_max - conn_tot It's worth noting that listeners theorically have such statistics, except that the distinction between connections and sessions is not clearly made in the code, so that will have to be improved later.
This commit is contained in:
parent
f1516d9840
commit
c73810f94f
@ -899,7 +899,7 @@ S (Servers).
|
||||
4. scur [LFBS]: current sessions
|
||||
5. smax [LFBS]: max sessions
|
||||
6. slim [LFBS]: configured session limit
|
||||
7. stot [LFBS]: cumulative number of connections
|
||||
7. stot [LFBS]: cumulative number of sessions
|
||||
8. bin [LFBS]: bytes in
|
||||
9. bout [LFBS]: bytes out
|
||||
10. dreq [LFB.]: requests denied because of security concerns.
|
||||
@ -1026,6 +1026,9 @@ S (Servers).
|
||||
74: cookie [..BS]: server's cookie value or backend's cookie name
|
||||
75: mode [LFBS]: proxy mode (tcp, http, health, unknown)
|
||||
76: algo [..B.]: load balancing algorithm
|
||||
77: conn_rate [.F..]: number of connections over the last elapsed second
|
||||
78: conn_rate_max [.F..]: highest known conn_rate
|
||||
79: conn_tot [.F..]: cumulative number of connections
|
||||
|
||||
|
||||
9.2. Unix Socket commands
|
||||
|
@ -337,6 +337,9 @@ enum stat_field {
|
||||
ST_F_COOKIE,
|
||||
ST_F_MODE,
|
||||
ST_F_ALGO,
|
||||
ST_F_CONN_RATE,
|
||||
ST_F_CONN_RATE_MAX,
|
||||
ST_F_CONN_TOT,
|
||||
|
||||
/* must always be the last one */
|
||||
ST_F_TOTAL_FIELDS
|
||||
@ -424,6 +427,9 @@ const char *stat_field_names[ST_F_TOTAL_FIELDS] = {
|
||||
[ST_F_COOKIE] = "cookie",
|
||||
[ST_F_MODE] = "mode",
|
||||
[ST_F_ALGO] = "algo",
|
||||
[ST_F_CONN_RATE] = "conn_rate",
|
||||
[ST_F_CONN_RATE_MAX] = "conn_rate_max",
|
||||
[ST_F_CONN_TOT] = "conn_tot",
|
||||
};
|
||||
|
||||
/* one line of stats */
|
||||
@ -3285,7 +3291,7 @@ static int stats_dump_fields_html(const struct field *stats, int admin, unsigned
|
||||
"<tr><th>Current session rate:</th><td>%s/s</td></tr>"
|
||||
"",
|
||||
U2H(stats[ST_F_RATE].u.u32),
|
||||
U2H(read_freq_ctr(&px->fe_conn_per_sec)),
|
||||
U2H(stats[ST_F_CONN_RATE].u.u32),
|
||||
U2H(stats[ST_F_RATE].u.u32));
|
||||
|
||||
if (strcmp(field_str(stats, ST_F_MODE), "http") == 0)
|
||||
@ -3301,7 +3307,7 @@ static int stats_dump_fields_html(const struct field *stats, int admin, unsigned
|
||||
"<tr><th>Max session rate:</th><td>%s/s</td></tr>"
|
||||
"",
|
||||
U2H(stats[ST_F_RATE_MAX].u.u32),
|
||||
U2H(px->fe_counters.cps_max),
|
||||
U2H(stats[ST_F_CONN_RATE_MAX].u.u32),
|
||||
U2H(stats[ST_F_RATE_MAX].u.u32));
|
||||
|
||||
if (strcmp(field_str(stats, ST_F_MODE), "http") == 0)
|
||||
@ -3322,9 +3328,9 @@ static int stats_dump_fields_html(const struct field *stats, int admin, unsigned
|
||||
"<tr><th>Cum. connections:</th><td>%s</td></tr>"
|
||||
"<tr><th>Cum. sessions:</th><td>%s</td></tr>"
|
||||
"",
|
||||
U2H(stats[ST_F_SCUR].u.u32), U2H(px->fe_counters.conn_max), U2H(stats[ST_F_SLIM].u.u32),
|
||||
U2H(stats[ST_F_SCUR].u.u32), U2H(stats[ST_F_SMAX].u.u32), U2H(stats[ST_F_SLIM].u.u32),
|
||||
U2H(stats[ST_F_STOT].u.u64),
|
||||
U2H(px->fe_counters.cum_conn),
|
||||
U2H(stats[ST_F_CONN_TOT].u.u64),
|
||||
U2H(stats[ST_F_STOT].u.u64));
|
||||
|
||||
/* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */
|
||||
@ -3947,6 +3953,11 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
|
||||
stats[ST_F_COMP_BYP] = mkf_u64(FN_COUNTER, px->fe_counters.comp_byp);
|
||||
stats[ST_F_COMP_RSP] = mkf_u64(FN_COUNTER, px->fe_counters.p.http.comp_rsp);
|
||||
|
||||
/* connections : conn_rate, conn_rate_max, conn_tot, conn_max */
|
||||
stats[ST_F_CONN_RATE] = mkf_u32(FN_RATE, read_freq_ctr(&px->fe_conn_per_sec));
|
||||
stats[ST_F_CONN_RATE_MAX] = mkf_u32(FN_MAX, px->fe_counters.cps_max);
|
||||
stats[ST_F_CONN_TOT] = mkf_u64(FN_COUNTER, px->fe_counters.cum_conn);
|
||||
|
||||
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
||||
int admin;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user