MINOR: quic_stats: Add a new stats module for QUIC
This is a very minimalist frontend only stats module with only one gauge for the QUIC establishing connections count.
This commit is contained in:
parent
2822593a12
commit
a58cafeb89
2
Makefile
2
Makefile
|
@ -637,7 +637,7 @@ OPTIONS_OBJS += src/quic_sock.o src/proto_quic.o src/xprt_quic.o src/quic_tls.o
|
|||
src/quic_frame.o src/quic_cc.o src/quic_cc_newreno.o src/mux_quic.o \
|
||||
src/cbuf.o src/qpack-dec.o src/qpack-tbl.o src/h3.o src/qpack-enc.o \
|
||||
src/hq_interop.o src/cfgparse-quic.o src/quic_loss.o \
|
||||
src/quic_stream.o
|
||||
src/quic_stream.o src/quic_stats.o
|
||||
endif
|
||||
|
||||
ifneq ($(USE_LUA),)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _HAPROXY_QUIC_STATS_T_H
|
||||
#define _HAPROXY_QUIC_STATS_T_H
|
||||
|
||||
#ifdef USE_QUIC
|
||||
#ifndef USE_OPENSSL
|
||||
#error "Must define USE_OPENSSL"
|
||||
#endif
|
||||
|
||||
extern struct stats_module quic_stats_module;
|
||||
|
||||
struct quic_counters {
|
||||
long long dropped_pkt; /* total number of dropped packets */
|
||||
long long retry_sent; /* total number of Retry sent */
|
||||
long long retry_validated; /* total number of validated Retry tokens */
|
||||
long long retry_error; /* total number of Retry token errors */
|
||||
long long conn_opening; /* total number of connection openings */
|
||||
long long hdshk_fail; /* total number of handshake failures */
|
||||
/* Streams related counters */
|
||||
long long data_blocked; /* total number of times DATA_BLOCKED frame was received */
|
||||
long long stream_data_blocked; /* total number of times STEAM_DATA_BLOCKED frame was received */
|
||||
long long streams_data_blocked_bidi; /* total number of times STREAMS_DATA_BLOCKED_BIDI frame was received */
|
||||
long long streams_data_blocked_uni; /* total number of times STREAMS_DATA_BLOCKED_UNI frame was received */
|
||||
};
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
#endif /* _HAPROXY_QUIC_STATS_T_H */
|
|
@ -0,0 +1,73 @@
|
|||
#include <haproxy/quic_stats-t.h>
|
||||
#include <haproxy/stats.h>
|
||||
|
||||
enum {
|
||||
QUIC_ST_DROPPED_PACKETS,
|
||||
QUIC_ST_RETRY_SENT,
|
||||
QUIC_ST_RETRY_VALIDATED,
|
||||
QUIC_ST_RETRY_ERRORS,
|
||||
QUIC_ST_CONN_OPENINGS,
|
||||
QUIC_ST_HDSHK_FAILS,
|
||||
/* Stream related counters */
|
||||
QUIC_ST_DATA_BLOCKED,
|
||||
QUIC_ST_STREAM_DATA_BLOCKED,
|
||||
QUIC_ST_STREAMS_DATA_BLOCKED_BIDI,
|
||||
QUIC_ST_STREAMS_DATA_BLOCKED_UNI,
|
||||
QUIC_STATS_COUNT /* must be the last */
|
||||
};
|
||||
|
||||
static struct name_desc quic_stats[] = {
|
||||
[QUIC_ST_DROPPED_PACKETS] = { .name = "quic_dropped_pkt",
|
||||
.desc = "Total number of dropped packets" },
|
||||
[QUIC_ST_RETRY_SENT] = { .name = "quic_retry_sent",
|
||||
.desc = "Total number of Retry sent" },
|
||||
[QUIC_ST_RETRY_VALIDATED] = { .name = "quic_retry_validated",
|
||||
.desc = "Total number of validated Retry tokens" },
|
||||
[QUIC_ST_RETRY_ERRORS] = { .name = "quic_retry_error",
|
||||
.desc = "Total number of Retry tokens errors" },
|
||||
[QUIC_ST_CONN_OPENINGS] = { .name = "quic_conn_opening",
|
||||
.desc = "Total number of connection openings" },
|
||||
[QUIC_ST_HDSHK_FAILS] = { .name = "quic_hdshk_fail",
|
||||
.desc = "Total number of handshake failures" },
|
||||
/* Streams related counters */
|
||||
[QUIC_ST_DATA_BLOCKED] = { .name = "quic_data_blocked",
|
||||
.desc = "Total number of times DATA_BLOCKED frame was received" },
|
||||
[QUIC_ST_STREAM_DATA_BLOCKED] = { .name = "quic_stream_data_blocked",
|
||||
.desc = "Total number of times STREAMS_BLOCKED frame was received" },
|
||||
[QUIC_ST_STREAMS_DATA_BLOCKED_BIDI] = { .name = "quic_streams_data_blocked_bidi",
|
||||
.desc = "Total number of times STREAM_DATA_BLOCKED_BIDI frame was received" },
|
||||
[QUIC_ST_STREAMS_DATA_BLOCKED_UNI] = { .name = "quic_streams_data_blocked_bidi",
|
||||
.desc = "Total number of times STREAM_DATA_BLOCKED_UNI frame was received" },
|
||||
};
|
||||
|
||||
struct quic_counters quic_counters;
|
||||
|
||||
static void quic_fill_stats(void *data, struct field *stats)
|
||||
{
|
||||
struct quic_counters *counters = data;
|
||||
|
||||
stats[QUIC_ST_DROPPED_PACKETS] = mkf_u64(FN_COUNTER, counters->dropped_pkt);
|
||||
stats[QUIC_ST_RETRY_SENT] = mkf_u64(FN_COUNTER, counters->retry_sent);
|
||||
stats[QUIC_ST_RETRY_VALIDATED] = mkf_u64(FN_COUNTER, counters->retry_validated);
|
||||
stats[QUIC_ST_RETRY_ERRORS] = mkf_u64(FN_COUNTER, counters->retry_error);
|
||||
stats[QUIC_ST_CONN_OPENINGS] = mkf_u64(FN_GAUGE, counters->conn_opening);
|
||||
stats[QUIC_ST_HDSHK_FAILS] = mkf_u64(FN_COUNTER, counters->hdshk_fail);
|
||||
/* Streams related counters */
|
||||
stats[QUIC_ST_DATA_BLOCKED] = mkf_u64(FN_COUNTER, counters->data_blocked);
|
||||
stats[QUIC_ST_STREAM_DATA_BLOCKED] = mkf_u64(FN_COUNTER, counters->stream_data_blocked);
|
||||
stats[QUIC_ST_STREAMS_DATA_BLOCKED_BIDI] = mkf_u64(FN_COUNTER, counters->streams_data_blocked_bidi);
|
||||
stats[QUIC_ST_STREAMS_DATA_BLOCKED_UNI] = mkf_u64(FN_COUNTER, counters->streams_data_blocked_uni);
|
||||
}
|
||||
|
||||
struct stats_module quic_stats_module = {
|
||||
.name = "quic",
|
||||
.fill_stats = quic_fill_stats,
|
||||
.stats = quic_stats,
|
||||
.stats_count = QUIC_STATS_COUNT,
|
||||
.counters = &quic_counters,
|
||||
.counters_size = sizeof(quic_counters),
|
||||
.domain_flags = MK_STATS_PROXY_DOMAIN(STATS_PX_CAP_FE),
|
||||
.clearable = 1,
|
||||
};
|
||||
|
||||
INITCALL1(STG_REGISTER, stats_register_module, &quic_stats_module);
|
Loading…
Reference in New Issue