mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-07 14:01:54 +00:00
[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:
parent
d9b587f260
commit
2465779459
@ -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;
|
||||
|
||||
|
@ -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, ",,,,,,");
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user