[MEDIUM] stats: split frontend and backend stats
It's very annoying that frontend and backend stats are merged because we
don't know what we're observing. For instance, if a "listen" instance
makes use of a distinct backend, it's impossible to know what the bytes_out
means.
Some points take care of not updating counters twice if the backend points
to the frontend, indicating a "listen" instance. The thing becomes more
complex when we try to add support for server side keep-alive, because we
have to maintain a pointer to the backend used for last request, and to
update its stats. But we can't perform such comparisons anymore because
the counters will not match anymore.
So in order to get rid of this situation, let's have both frontend AND
backend stats in the "struct proxy". We simply update the relevant ones
during activity. Some of them are only accounted for in the backend,
while others are just for frontend. Maybe we can improve a bit on that
later, but the essential part is that those counters now reflect what
they really mean.
diff --git a/src/backend.c b/src/backend.c
index e2ad5b2..93a8fc8 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -613,7 +613,7 @@
goto out;
}
else if (srv != prev_srv) {
- s->be->counters.cum_lbconn++;
+ s->be->be_counters.cum_lbconn++;
srv->counters.cum_lbconn++;
}
set_target_server(&s->target, srv);
@@ -800,10 +800,10 @@
}
s->flags |= SN_REDISP;
prev_srv->counters.redispatches++;
- s->be->counters.redispatches++;
+ s->be->be_counters.redispatches++;
} else {
prev_srv->counters.retries++;
- s->be->counters.retries++;
+ s->be->be_counters.retries++;
}
}
}
@@ -1036,7 +1036,7 @@
}
srv->counters.failed_conns++;
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
return 1;
case SRV_STATUS_NOSRV:
@@ -1046,7 +1046,7 @@
t->req->cons->err_loc = NULL;
}
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
return 1;
case SRV_STATUS_QUEUED:
@@ -1066,7 +1066,7 @@
srv_inc_sess_ctr(srv);
if (srv)
srv->counters.failed_conns++;
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
/* release other sessions waiting for this server */
if (may_dequeue_tasks(srv, t->be))