mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-05 02:49:01 +00:00
MINOR: stats: report the number of active peers in "show info"
Peers are the last type of activity which can maintain a job present, so it's important to report that such an entity is still active to explain why the job count may be higher than zero. Here by "ActivePeers" we report peers sessions, which include both established connections and outgoing connection attempts.
This commit is contained in:
parent
00098ea034
commit
199ad24661
@ -224,6 +224,7 @@ extern unsigned long pid_bit; /* bit corresponding to the process id */
|
||||
extern int actconn; /* # of active sessions */
|
||||
extern int listeners;
|
||||
extern int jobs; /* # of active jobs (listeners, sessions, open devices) */
|
||||
extern int active_peers; /* # of active peers (connection attempts and successes) */
|
||||
extern THREAD_LOCAL struct buffer trash;
|
||||
extern int nb_oldpids; /* contains the number of old pids found */
|
||||
extern const int zero;
|
||||
|
@ -291,6 +291,7 @@ enum info_field {
|
||||
INF_STOPPING,
|
||||
INF_JOBS,
|
||||
INF_LISTENERS,
|
||||
INF_ACTIVE_PEERS,
|
||||
|
||||
/* must always be the last one */
|
||||
INF_TOTAL_FIELDS
|
||||
|
@ -175,6 +175,7 @@ struct activity activity[MAX_THREADS] __attribute__((aligned(64))) = { };
|
||||
int stopping; /* non zero means stopping in progress */
|
||||
int killed; /* non zero means a hard-stop is triggered */
|
||||
int jobs = 0; /* number of active jobs (conns, listeners, active tasks, ...) */
|
||||
int active_peers = 0; /* number of active peers (connection attempts and connected) */
|
||||
|
||||
/* Here we store informations about the pids of the processes we may pause
|
||||
* or kill. We will send them a signal every 10 ms until we can bind to all
|
||||
|
@ -506,6 +506,7 @@ static void peer_session_release(struct appctx *appctx)
|
||||
|
||||
/* peer session identified */
|
||||
if (peer) {
|
||||
HA_ATOMIC_SUB(&active_peers, 1);
|
||||
HA_SPIN_LOCK(PEER_LOCK, &peer->lock);
|
||||
if (peer->appctx == appctx) {
|
||||
/* Re-init current table pointers to force announcement on re-connect */
|
||||
@ -718,6 +719,7 @@ switchstate:
|
||||
curpeer->appctx = appctx;
|
||||
appctx->ctx.peers.ptr = curpeer;
|
||||
appctx->st0 = PEER_SESS_ST_SENDSUCCESS;
|
||||
HA_ATOMIC_ADD(&active_peers, 1);
|
||||
/* fall through */
|
||||
}
|
||||
case PEER_SESS_ST_SENDSUCCESS: {
|
||||
@ -1979,6 +1981,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
|
||||
|
||||
peer->appctx = appctx;
|
||||
task_wakeup(s->task, TASK_WOKEN_INIT);
|
||||
HA_ATOMIC_ADD(&active_peers, 1);
|
||||
return appctx;
|
||||
|
||||
/* Error unrolling */
|
||||
|
@ -133,6 +133,7 @@ const char *info_field_names[INF_TOTAL_FIELDS] = {
|
||||
[INF_STOPPING] = "Stopping",
|
||||
[INF_JOBS] = "Jobs",
|
||||
[INF_LISTENERS] = "Listeners",
|
||||
[INF_ACTIVE_PEERS] = "ActivePeers",
|
||||
};
|
||||
|
||||
const char *stat_field_names[ST_F_TOTAL_FIELDS] = {
|
||||
@ -3298,6 +3299,7 @@ int stats_fill_info(struct field *info, int len)
|
||||
info[INF_STOPPING] = mkf_u32(0, stopping);
|
||||
info[INF_JOBS] = mkf_u32(0, jobs);
|
||||
info[INF_LISTENERS] = mkf_u32(0, listeners);
|
||||
info[INF_ACTIVE_PEERS] = mkf_u32(0, active_peers);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user