MINOR: quic: Add two new stats counters for sendto() errors

Add "quic_socket_full" new stats counter for sendto() errors with EAGAIN as errno.
and "quic_sendto_err" counter for any other error.
This commit is contained in:
Frédéric Lécaille 2022-08-04 12:00:00 +02:00 committed by Amaury Denoyelle
parent af5138fd07
commit 8ecb7363b5
5 changed files with 18 additions and 4 deletions

View File

@ -12,6 +12,8 @@ enum {
QUIC_ST_DROPPED_PACKET,
QUIC_ST_DROPPED_PACKET_BUFOVERRUN,
QUIC_ST_DROPPED_PARSING,
QUIC_ST_SOCKET_FULL,
QUIC_ST_SENDTO_ERR,
QUIC_ST_LOST_PACKET,
QUIC_ST_TOO_SHORT_INITIAL_DGRAM,
QUIC_ST_RETRY_SENT,
@ -52,6 +54,8 @@ struct quic_counters {
long long dropped_pkt; /* total number of dropped packets */
long long dropped_pkt_bufoverrun;/* total number of dropped packets because of buffer overrun */
long long dropped_parsing; /* total number of dropped packets upon parsing errors */
long long socket_full; /* total number of EAGAIN errors on sendto() calls */
long long sendto_err; /* total number of errors on sendto() calls, EAGAIN excepted */
long long lost_pkt; /* total number of lost packets */
long long too_short_initial_dgram; /* total number of too short datagrams with Initial packets */
long long retry_sent; /* total number of Retry sent */

View File

@ -703,7 +703,6 @@ struct quic_conn {
unsigned int nb_pkt_since_cc;
const struct qcc_app_ops *app_ops;
unsigned int sendto_err;
struct quic_counters *prx_counters;
};

View File

@ -393,8 +393,14 @@ size_t qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
}
else if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK ||
errno == ENOTCONN || errno == EINPROGRESS || errno == EBADF) {
struct proxy *prx = qc->li->bind_conf->frontend;
struct quic_counters *prx_counters =
EXTRA_COUNTERS_GET(prx->extra_counters_fe, &quic_stats_module);
/* TODO must be handle properly. It is justified for UDP ? */
qc->sendto_err++;
if (errno == EAGAIN || errno == EWOULDBLOCK)
HA_ATOMIC_INC(&prx_counters->socket_full);
else
HA_ATOMIC_INC(&prx_counters->sendto_err);
}
else if (errno) {
/* TODO unlisted errno : handle it explicitely. */

View File

@ -8,6 +8,10 @@ static struct name_desc quic_stats[] = {
.desc = "Total number of dropped packets because of buffer overrun" },
[QUIC_ST_DROPPED_PARSING] = { .name = "quic_dropped_parsing_pkt",
.desc = "Total number of dropped packets upon parsing error" },
[QUIC_ST_SOCKET_FULL] = { .name = "quic_socket_full",
.desc = "Total number of EAGAIN error on sendto() calls" },
[QUIC_ST_SENDTO_ERR] = { .name = "quic_sendto_err",
.desc = "Total number of error on sendto() calls, EAGAIN excepted" },
[QUIC_ST_LOST_PACKET] = { .name = "quic_lost_pkt",
.desc = "Total number of lost sent packets" },
[QUIC_ST_TOO_SHORT_INITIAL_DGRAM] = { .name = "quic_too_short_dgram",
@ -83,6 +87,8 @@ static void quic_fill_stats(void *data, struct field *stats)
stats[QUIC_ST_DROPPED_PACKET] = mkf_u64(FN_COUNTER, counters->dropped_pkt);
stats[QUIC_ST_DROPPED_PACKET_BUFOVERRUN] = mkf_u64(FN_COUNTER, counters->dropped_pkt_bufoverrun);
stats[QUIC_ST_DROPPED_PARSING] = mkf_u64(FN_COUNTER, counters->dropped_parsing);
stats[QUIC_ST_SOCKET_FULL] = mkf_u64(FN_COUNTER, counters->socket_full);
stats[QUIC_ST_SENDTO_ERR] = mkf_u64(FN_COUNTER, counters->sendto_err);
stats[QUIC_ST_LOST_PACKET] = mkf_u64(FN_COUNTER, counters->lost_pkt);
stats[QUIC_ST_TOO_SHORT_INITIAL_DGRAM] = mkf_u64(FN_COUNTER, counters->too_short_initial_dgram);
stats[QUIC_ST_RETRY_SENT] = mkf_u64(FN_COUNTER, counters->retry_sent);

View File

@ -598,7 +598,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
if (mask & QUIC_EV_CONN_SPPKTS) {
const struct quic_tx_packet *pkt = a2;
chunk_appendf(&trace_buf, " err=%u cwnd=%llu ppif=%llu pif=%llu", qc->sendto_err,
chunk_appendf(&trace_buf, " cwnd=%llu ppif=%llu pif=%llu",
(unsigned long long)qc->path->cwnd,
(unsigned long long)qc->path->prep_in_flight,
(unsigned long long)qc->path->in_flight);
@ -4397,7 +4397,6 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
qc->streams_by_id = EB_ROOT_UNIQUE;
qc->stream_buf_count = 0;
qc->sendto_err = 0;
memcpy(&qc->peer_addr, saddr, sizeof qc->peer_addr);
if (server && !qc_lstnr_params_init(qc, &l->bind_conf->quic_params,