MINOR: stats: Expose native cum_req metric for a server
Expose native cum_req metric for a server: so far it was calculated as a sum or all responses. Rename it from Cum. HTTP Responses to Cum. HTTP Requests to be consistent with Frontend and Backend.
This commit is contained in:
parent
4dc2b57d51
commit
3c27ddabec
|
@ -2061,6 +2061,11 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
|||
case ST_F_LBTOT:
|
||||
metric = mkf_u64(FN_COUNTER, sv->counters.cum_lbconn);
|
||||
break;
|
||||
case ST_F_REQ_TOT:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
goto next_px;
|
||||
metric = mkf_u64(FN_COUNTER, sv->counters.p.http.cum_req);
|
||||
break;
|
||||
case ST_F_HRSP_1XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
goto next_px;
|
||||
|
|
|
@ -1721,8 +1721,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||
if (n == 4)
|
||||
stream_inc_http_err_ctr(s);
|
||||
|
||||
if (objt_server(s->target))
|
||||
if (objt_server(s->target)) {
|
||||
_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.p.http.rsp[n], 1);
|
||||
_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.p.http.cum_req, 1);
|
||||
}
|
||||
|
||||
/* Adjust server's health based on status code. Note: status codes 501
|
||||
* and 505 are triggered on demand by client request, so we must not
|
||||
|
|
32
src/stats.c
32
src/stats.c
|
@ -1016,19 +1016,10 @@ static int stats_dump_fields_html(struct buffer *out,
|
|||
|
||||
/* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */
|
||||
if (strcmp(field_str(stats, ST_F_MODE), "http") == 0) {
|
||||
unsigned long long tot;
|
||||
|
||||
tot = stats[ST_F_HRSP_OTHER].u.u64;
|
||||
tot += stats[ST_F_HRSP_1XX].u.u64;
|
||||
tot += stats[ST_F_HRSP_2XX].u.u64;
|
||||
tot += stats[ST_F_HRSP_3XX].u.u64;
|
||||
tot += stats[ST_F_HRSP_4XX].u.u64;
|
||||
tot += stats[ST_F_HRSP_5XX].u.u64;
|
||||
|
||||
chunk_appendf(out,
|
||||
"<tr><th>New connections:</th><td>%s</td></tr>"
|
||||
"<tr><th>Reused connections:</th><td>%s</td><td>(%d%%)</td></tr>"
|
||||
"<tr><th>Cum. HTTP responses:</th><td>%s</td></tr>"
|
||||
"<tr><th>Cum. HTTP requests:</th><td>%s</td></tr>"
|
||||
"<tr><th>- HTTP 1xx responses:</th><td>%s</td><td>(%d%%)</td></tr>"
|
||||
"<tr><th>- HTTP 2xx responses:</th><td>%s</td><td>(%d%%)</td></tr>"
|
||||
"<tr><th>- HTTP 3xx responses:</th><td>%s</td><td>(%d%%)</td></tr>"
|
||||
|
@ -1042,13 +1033,19 @@ static int stats_dump_fields_html(struct buffer *out,
|
|||
U2H(stats[ST_F_REUSE].u.u64),
|
||||
(stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64) ?
|
||||
(int)(100 * stats[ST_F_REUSE].u.u64 / (stats[ST_F_CONNECT].u.u64 + stats[ST_F_REUSE].u.u64)) : 0,
|
||||
U2H(tot),
|
||||
U2H(stats[ST_F_HRSP_1XX].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_1XX].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_HRSP_2XX].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_2XX].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_HRSP_3XX].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_3XX].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_HRSP_4XX].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_4XX].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_HRSP_5XX].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_5XX].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_HRSP_OTHER].u.u64), tot ? (int)(100 * stats[ST_F_HRSP_OTHER].u.u64 / tot) : 0,
|
||||
U2H(stats[ST_F_REQ_TOT].u.u64),
|
||||
U2H(stats[ST_F_HRSP_1XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_1XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_HRSP_2XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_2XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_HRSP_3XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_3XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_HRSP_4XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_4XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_HRSP_5XX].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_5XX].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_HRSP_OTHER].u.u64), stats[ST_F_REQ_TOT].u.u64 ?
|
||||
(int)(100 * stats[ST_F_HRSP_OTHER].u.u64 / stats[ST_F_REQ_TOT].u.u64) : 0,
|
||||
U2H(stats[ST_F_WREW].u.u64),
|
||||
U2H(stats[ST_F_EINT].u.u64));
|
||||
}
|
||||
|
@ -1796,6 +1793,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
|
|||
|
||||
/* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
|
||||
if (px->mode == PR_MODE_HTTP) {
|
||||
stats[ST_F_REQ_TOT] = mkf_u64(FN_COUNTER, sv->counters.p.http.cum_req);
|
||||
stats[ST_F_HRSP_1XX] = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[1]);
|
||||
stats[ST_F_HRSP_2XX] = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[2]);
|
||||
stats[ST_F_HRSP_3XX] = mkf_u64(FN_COUNTER, sv->counters.p.http.rsp[3]);
|
||||
|
|
Loading…
Reference in New Issue