diff --git a/include/types/counters.h b/include/types/counters.h index 3e62763f8..06ce61728 100644 --- a/include/types/counters.h +++ b/include/types/counters.h @@ -23,8 +23,44 @@ #ifndef _TYPES_COUNTERS_H #define _TYPES_COUNTERS_H -/* maybe later we might thing about having a different struct for FE and BE */ -struct pxcounters { +/* counters used by listeners and frontends */ +struct fe_counters { + unsigned int conn_max; /* max # of active sessions */ + long long cum_conn; /* cumulated number of received connections */ + long long cum_sess; /* cumulated number of accepted connections */ + + unsigned int cps_max; /* maximum of new connections received per second */ + unsigned int sps_max; /* maximum of new connections accepted per second (sessions) */ + + long long bytes_in; /* number of bytes transferred from the client to the server */ + long long bytes_out; /* number of bytes transferred from the server to the client */ + + long long comp_in; /* input bytes fed to the compressor */ + long long comp_out; /* output bytes emitted by the compressor */ + long long comp_byp; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */ + + long long denied_req; /* blocked requests because of security concerns */ + long long denied_resp; /* blocked responses because of security concerns */ + long long failed_req; /* failed requests (eg: invalid or timeout) */ + long long denied_conn; /* denied connection requests (tcp-req-conn rules) */ + long long denied_sess; /* denied session requests (tcp-req-sess rules) */ + + long long cli_aborts; /* aborted responses during DATA phase caused by the client */ + long long srv_aborts; /* aborted responses during DATA phase caused by the server */ + long long intercepted_req; /* number of monitoring or stats requests intercepted by the frontend */ + + union { + struct { + long long cum_req; /* cumulated number of processed HTTP requests */ + long long comp_rsp; /* number of compressed responses */ + unsigned int rps_max; /* maximum of new HTTP requests second observed */ + long long rsp[6]; /* http response codes */ + } http; + } p; /* protocol-specific stats */ +}; + +/* counters used by listeners and frontends */ +struct be_counters { unsigned int conn_max; /* max # of active sessions */ long long cum_conn; /* cumulated number of received connections */ long long cum_sess; /* cumulated number of accepted connections */ @@ -34,6 +70,7 @@ struct pxcounters { unsigned int cps_max; /* maximum of new connections received per second */ unsigned int sps_max; /* maximum of new connections accepted per second (sessions) */ unsigned int nbpend_max; /* max number of pending connections with no server assigned yet (BE only) */ + unsigned int cur_sess_max; /* max number of currently active sessions */ long long bytes_in; /* number of bytes transferred from the client to the server */ long long bytes_out; /* number of bytes transferred from the server to the client */ @@ -42,11 +79,8 @@ struct pxcounters { long long comp_out; /* output bytes emitted by the compressor */ long long comp_byp; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */ - long long denied_req; /* blocked requests/responses because of security concerns */ - long long denied_resp; /* blocked requests/responses because of security concerns */ - long long failed_req; /* failed requests (eg: invalid or timeout) */ - long long denied_conn; /* denied connection requests (tcp-req-conn rules) */ - long long denied_sess; /* denied session requests (tcp-req-sess rules) */ + long long denied_req; /* blocked requests because of security concerns */ + long long denied_resp; /* blocked responses because of security concerns */ long long failed_conns; /* failed connect() attempts (BE only) */ long long failed_resp; /* failed responses (BE only) */ @@ -54,7 +88,10 @@ struct pxcounters { long long srv_aborts; /* aborted responses during DATA phase caused by the server */ long long retries; /* retried and redispatched connections (BE only) */ long long redispatches; /* retried and redispatched connections (BE only) */ - long long intercepted_req; /* number of monitoring or stats requests intercepted by the frontend */ + long long failed_secu; /* blocked responses because of security concerns */ + + long long failed_checks, failed_hana; /* failed health checks and health analyses for servers */ + long long down_trans; /* up->down transitions */ unsigned int q_time, c_time, d_time, t_time; /* sums of conn_time, queue_time, data_time, total_time */ @@ -68,50 +105,6 @@ struct pxcounters { } p; /* protocol-specific stats */ }; -struct licounters { - unsigned int conn_max; /* max # of active listener sessions */ - - long long cum_conn; /* cumulated number of received connections */ - long long cum_sess; /* cumulated number of accepted sessions */ - - long long bytes_in; /* number of bytes transferred from the client to the server */ - long long bytes_out; /* number of bytes transferred from the server to the client */ - - long long denied_req, denied_resp; /* blocked requests/responses because of security concerns */ - long long failed_req; /* failed requests (eg: invalid or timeout) */ - long long denied_conn; /* denied connection requests (tcp-req-conn rules) */ - long long denied_sess; /* denied session requests (tcp-req-sess rules) */ -}; - -struct srvcounters { - unsigned int cur_sess_max; /* max number of currently active sessions */ - unsigned int nbpend_max; /* max number of pending connections reached */ - unsigned int sps_max; /* maximum of new sessions per second seen on this server */ - - long long cum_sess; /* cumulated number of sessions really sent to this server */ - long long cum_lbconn; /* cumulated number of sessions directed by load balancing */ - unsigned long last_sess; /* last session time */ - - long long bytes_in; /* number of bytes transferred from the client to the server */ - long long bytes_out; /* number of bytes transferred from the server to the client */ - - long long failed_conns, failed_resp; /* failed connect() and responses */ - long long cli_aborts, srv_aborts; /* aborted responses during DATA phase due to client or server */ - long long retries, redispatches; /* retried and redispatched connections */ - long long failed_secu; /* blocked responses because of security concerns */ - - unsigned int q_time, c_time, d_time, t_time; /* sums of conn_time, queue_time, data_time, total_time */ - - union { - struct { - long long rsp[6]; /* http response codes */ - } http; - } p; - - long long failed_checks, failed_hana; /* failed health checks and health analyses */ - long long down_trans; /* up->down transitions */ -}; - #endif /* _TYPES_COUNTERS_H */ /* diff --git a/include/types/listener.h b/include/types/listener.h index 1f14cc0bd..d06e4e7c8 100644 --- a/include/types/listener.h +++ b/include/types/listener.h @@ -39,7 +39,7 @@ struct task; struct protocol; struct xprt_ops; struct proxy; -struct licounters; +struct fe_counters; /* listener state */ enum li_state { @@ -171,7 +171,7 @@ struct listener { char *name; /* listener's name */ int luid; /* listener universally unique ID, used for SNMP */ int options; /* socket options : LI_O_* */ - struct licounters *counters; /* statistics counters */ + struct fe_counters *counters; /* statistics counters */ struct protocol *proto; /* protocol this listener belongs to */ struct xprt_ops *xprt; /* transport-layer operations for this socket */ int nbconn; /* current number of connections on this listener */ diff --git a/include/types/proxy.h b/include/types/proxy.h index 0b194cb73..3bf5a4d46 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -362,8 +362,8 @@ struct proxy { struct pool_head *req_cap_pool, /* pools of pre-allocated char ** used to build the streams */ *rsp_cap_pool; struct list req_add, rsp_add; /* headers to be added */ - struct pxcounters be_counters; /* backend statistics counters */ - struct pxcounters fe_counters; /* frontend statistics counters */ + struct be_counters be_counters; /* backend statistics counters */ + struct fe_counters fe_counters; /* frontend statistics counters */ struct list listener_queue; /* list of the temporarily limited listeners because of lack of a proxy resource */ struct stktable table; /* table for storing sticking streams */ diff --git a/include/types/server.h b/include/types/server.h index c6c581c74..20c314b99 100644 --- a/include/types/server.h +++ b/include/types/server.h @@ -192,7 +192,7 @@ struct server { int nbpend; /* number of pending connections */ int maxqueue; /* maximum number of pending connections allowed */ struct freq_ctr sess_per_sec; /* sessions per second on this server */ - struct srvcounters counters; /* statistics counters */ + struct be_counters counters; /* statistics counters */ struct list pendconns; /* pending connections */ struct list actconns; /* active connections */ diff --git a/src/cfgparse.c b/src/cfgparse.c index fbd736466..4fc63bde3 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -9009,7 +9009,7 @@ out_uri_auth_compat: /* enable separate counters */ if (curproxy->options2 & PR_O2_SOCKSTAT) { - listener->counters = calloc(1, sizeof(struct licounters)); + listener->counters = calloc(1, sizeof(*listener->counters)); if (!listener->name) memprintf(&listener->name, "sock-%d", listener->luid); } diff --git a/src/stats.c b/src/stats.c index bfd16994d..497aa4779 100644 --- a/src/stats.c +++ b/src/stats.c @@ -929,7 +929,6 @@ static int stats_dump_fields_html(struct chunk *out, const struct field *stats, "- HTTP 4xx responses:%s" "- HTTP 5xx responses:%s" "- other responses:%s" - "Intercepted requests:%s" "Avg over last 1024 success. conn." "", U2H(stats[ST_F_REQ_TOT].u.u64), @@ -941,8 +940,7 @@ static int stats_dump_fields_html(struct chunk *out, const struct field *stats, U2H(stats[ST_F_HRSP_3XX].u.u64), U2H(stats[ST_F_HRSP_4XX].u.u64), U2H(stats[ST_F_HRSP_5XX].u.u64), - U2H(stats[ST_F_HRSP_OTHER].u.u64), - U2H(stats[ST_F_INTERCEPTED].u.u64)); + U2H(stats[ST_F_HRSP_OTHER].u.u64)); } chunk_appendf(out, "- Queue time:%sms", U2H(stats[ST_F_QTIME].u.u32)); @@ -1547,7 +1545,6 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le stats[ST_F_HRSP_4XX] = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[4]); stats[ST_F_HRSP_5XX] = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[5]); stats[ST_F_HRSP_OTHER] = mkf_u64(FN_COUNTER, px->be_counters.p.http.rsp[0]); - stats[ST_F_INTERCEPTED] = mkf_u64(FN_COUNTER, px->be_counters.intercepted_req); } stats[ST_F_CLI_ABRT] = mkf_u64(FN_COUNTER, px->be_counters.cli_aborts); @@ -3065,7 +3062,6 @@ static int cli_parse_clear_counters(char **args, struct appctx *appctx, void *pr px->fe_counters.p.http.rps_max = 0; px->fe_counters.sps_max = 0; px->fe_counters.cps_max = 0; - px->fe_counters.nbpend_max = 0; } for (sv = px->srv; sv; sv = sv->next)