[STATS] separate frontend and backend HTTP stats
It is wrong to merge FE and BE stats for a proxy because when we consult a
BE's stats, it reflects the FE's stats eventhough the BE has received no
traffic. The most common example happens with listen instances, where the
backend gets credited for all the trafic even when a use_backend rule makes
use of another backend.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 5f62dff..c861ee5 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -1435,9 +1435,9 @@
chunk_printf(&msg, " title=\"rsp codes:");
for (i = 1; i < 6; i++)
- chunk_printf(&msg, " %dxx=%lld,", i, px->counters.p.http.rsp[i]);
+ chunk_printf(&msg, " %dxx=%lld,", i, px->counters.fe.http.rsp[i]);
- chunk_printf(&msg, " other=%lld\"", px->counters.p.http.rsp[0]);
+ chunk_printf(&msg, " other=%lld\"", px->counters.fe.http.rsp[0]);
}
chunk_printf(&msg,
@@ -1504,9 +1504,9 @@
int i;
for (i=1; i<6; i++)
- chunk_printf(&msg, "%lld,", px->counters.p.http.rsp[i]);
+ chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[i]);
- chunk_printf(&msg, "%lld,", px->counters.p.http.rsp[0]);
+ chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[0]);
} else {
chunk_printf(&msg, ",,,,,,");
}
@@ -2097,9 +2097,9 @@
chunk_printf(&msg, " title=\"rsp codes:");
for (i = 1; i < 6; i++)
- chunk_printf(&msg, " %dxx=%lld", i, px->counters.p.http.rsp[i]);
+ chunk_printf(&msg, " %dxx=%lld", i, px->counters.be.http.rsp[i]);
- chunk_printf(&msg, " other=%lld\"", px->counters.p.http.rsp[0]);
+ chunk_printf(&msg, " other=%lld\"", px->counters.be.http.rsp[0]);
}
chunk_printf(&msg,
@@ -2194,9 +2194,9 @@
int i;
for (i=1; i<6; i++)
- chunk_printf(&msg, "%lld,", px->counters.p.http.rsp[i]);
+ chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[i]);
- chunk_printf(&msg, "%lld,", px->counters.p.http.rsp[0]);
+ chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[0]);
} else {
chunk_printf(&msg, ",,,,,,");
}
diff --git a/src/proto_http.c b/src/proto_http.c
index 0820be5..cb51205 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -3644,11 +3644,11 @@
n = 0;
if (s->fe->mode == PR_MODE_HTTP)
- s->fe->counters.p.http.rsp[n]++;
+ s->fe->counters.fe.http.rsp[n]++;
- if ((s->flags & SN_BE_ASSIGNED) && (s->fe != s->be) &&
+ if ((s->flags & SN_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP))
- s->be->counters.p.http.rsp[n]++;
+ s->be->counters.be.http.rsp[n]++;
}
/* don't count other requests' data */
diff --git a/src/session.c b/src/session.c
index c05cc8b..91edd73 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1575,11 +1575,11 @@
n = 0;
if (s->fe->mode == PR_MODE_HTTP)
- s->fe->counters.p.http.rsp[n]++;
+ s->fe->counters.fe.http.rsp[n]++;
- if ((s->flags & SN_BE_ASSIGNED) && (s->fe != s->be) &&
+ if ((s->flags & SN_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP))
- s->be->counters.p.http.rsp[n]++;
+ s->be->counters.be.http.rsp[n]++;
}
/* let's do a final log if we need it */