[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.
This commit is contained in:
Willy Tarreau 2010-02-26 10:30:28 +01:00
parent d9b587f260
commit 2465779459
4 changed files with 17 additions and 17 deletions

View File

@ -42,9 +42,9 @@ struct pxcounters {
union {
struct {
long long rsp[6]; /* http resonse codes */
long long rsp[6]; /* http response codes */
} http;
} p;
} fe, be; /* FE and BE stats */
long long failed_conns, failed_resp; /* failed connect() and responses */
long long retries, redispatches; /* retried and redispatched connections */
@ -79,7 +79,7 @@ struct srvcounters {
union {
struct {
long long rsp[6]; /* http resonse codes */
long long rsp[6]; /* http response codes */
} http;
} p;

View File

@ -1435,9 +1435,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
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 stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
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 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
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 stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
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, ",,,,,,");
}

View File

@ -3644,11 +3644,11 @@ void http_end_txn_clean_session(struct session *s)
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 */

View File

@ -1575,11 +1575,11 @@ resync_stream_interface:
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 */