mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MINOR: compression: Count separately request and response compression
Duplicate the compression counters, so that we have separate counters for request and response compression.
This commit is contained in:
parent
db573e9c58
commit
dea25f51b6
@ -36,9 +36,10 @@ struct fe_counters {
|
||||
long long bytes_in; /* number of bytes transferred from the client to the server */
|
||||
long long bytes_out; /* number of bytes transferred from the server to the client */
|
||||
|
||||
long long comp_in; /* input bytes fed to the compressor */
|
||||
long long comp_out; /* output bytes emitted by the compressor */
|
||||
long long comp_byp; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */
|
||||
/* compression counters, index 0 for requests, 1 for responses */
|
||||
long long comp_in[2]; /* input bytes fed to the compressor */
|
||||
long long comp_out[2]; /* output bytes emitted by the compressor */
|
||||
long long comp_byp[2]; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */
|
||||
|
||||
long long denied_req; /* blocked requests because of security concerns */
|
||||
long long denied_resp; /* blocked responses because of security concerns */
|
||||
@ -80,9 +81,10 @@ struct be_counters {
|
||||
long long bytes_in; /* number of bytes transferred from the client to the server */
|
||||
long long bytes_out; /* number of bytes transferred from the server to the client */
|
||||
|
||||
long long comp_in; /* input bytes fed to the compressor */
|
||||
long long comp_out; /* output bytes emitted by the compressor */
|
||||
long long comp_byp; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */
|
||||
/* compression counters, index 0 for requests, 1 for responses */
|
||||
long long comp_in[2]; /* input bytes fed to the compressor */
|
||||
long long comp_out[2]; /* output bytes emitted by the compressor */
|
||||
long long comp_byp[2]; /* input bytes that bypassed the compressor (cpu/ram/bw limitation) */
|
||||
|
||||
long long denied_req; /* blocked requests because of security concerns */
|
||||
long long denied_resp; /* blocked responses because of security concerns */
|
||||
|
@ -277,14 +277,14 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
|
||||
|
||||
if (st->comp_ctx[dir] && st->comp_ctx[dir]->cur_lvl > 0) {
|
||||
update_freq_ctr(&global.comp_bps_in, consumed);
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_in, consumed);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_in, consumed);
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_in[dir], consumed);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_in[dir], consumed);
|
||||
update_freq_ctr(&global.comp_bps_out, to_forward);
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_out, to_forward);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_out, to_forward);
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_out[dir], to_forward);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_out[dir], to_forward);
|
||||
} else {
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_byp, consumed);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_byp, consumed);
|
||||
_HA_ATOMIC_ADD(&strm_fe(s)->fe_counters.comp_byp[dir], consumed);
|
||||
_HA_ATOMIC_ADD(&s->be->be_counters.comp_byp[dir], consumed);
|
||||
}
|
||||
return to_forward;
|
||||
|
||||
|
12
src/stats.c
12
src/stats.c
@ -1847,13 +1847,13 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||
break;
|
||||
}
|
||||
case ST_F_COMP_IN:
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_in);
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_in[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_OUT:
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_out);
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_out[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_BYP:
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_byp);
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.comp_byp[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_RSP:
|
||||
metric = mkf_u64(FN_COUNTER, px->fe_counters.p.http.comp_rsp);
|
||||
@ -2878,13 +2878,13 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.srv_aborts);
|
||||
break;
|
||||
case ST_F_COMP_IN:
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_in);
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_in[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_OUT:
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_out);
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_out[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_BYP:
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_byp);
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.comp_byp[COMP_DIR_RES]);
|
||||
break;
|
||||
case ST_F_COMP_RSP:
|
||||
metric = mkf_u64(FN_COUNTER, px->be_counters.p.http.comp_rsp);
|
||||
|
Loading…
Reference in New Issue
Block a user