mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-05 04:56:10 +02:00
CLEANUP: stats: improve field selection for frontend http fields
while working on backend/servers I realised I could have written that in a better way and avoid one extra break. This is slightly improving readiness. also while being here, fix function declaration which was not 100% accurate. this patch does not change the behaviour of the code. Signed-off-by: William Dauchy <wdauchy@gmail.com>
This commit is contained in:
parent
18a2c6ed49
commit
2107a0faf5
@ -47,7 +47,7 @@ int stats_dump_one_line(const struct field *stats, size_t stats_count, struct ap
|
||||
|
||||
int stats_fill_info(struct field *info, int len);
|
||||
int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||
enum stat_field *field);
|
||||
enum stat_field *selected_field);
|
||||
int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
|
||||
struct field *stats, int len);
|
||||
int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
|
||||
|
||||
45
src/stats.c
45
src/stats.c
@ -1713,49 +1713,40 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.internal_errors);
|
||||
break;
|
||||
case ST_F_HRSP_1XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[1]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[1]);
|
||||
break;
|
||||
case ST_F_HRSP_2XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[2]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[2]);
|
||||
break;
|
||||
case ST_F_HRSP_3XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[3]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[3]);
|
||||
break;
|
||||
case ST_F_HRSP_4XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[4]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[4]);
|
||||
break;
|
||||
case ST_F_HRSP_5XX:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[5]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[5]);
|
||||
break;
|
||||
case ST_F_HRSP_OTHER:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[0]);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.rsp[0]);
|
||||
break;
|
||||
case ST_F_INTERCEPTED:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.intercepted_req);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.intercepted_req);
|
||||
break;
|
||||
case ST_F_CACHE_LOOKUPS:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_lookups);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_lookups);
|
||||
break;
|
||||
case ST_F_CACHE_HITS:
|
||||
if (px->mode != PR_MODE_HTTP)
|
||||
break;
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_hits);
|
||||
if (px->mode == PR_MODE_HTTP)
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.cache_hits);
|
||||
break;
|
||||
case ST_F_REQ_RATE:
|
||||
metric = mkf_u32(FN_RATE, read_freq_ctr(&px->fe_req_per_sec));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user