1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
#include <haproxy/quic_frame-t.h>
#include <haproxy/quic_stats-t.h>
#include <haproxy/stats.h>
static struct name_desc quic_stats[] = {
[QUIC_ST_RXBUF_FULL] = { .name = "quic_rxbuf_full",
.desc = "Total number of cancelled reception due to full receiver buffer" },
[QUIC_ST_DROPPED_PACKET] = { .name = "quic_dropped_pkt",
.desc = "Total number of dropped packets" },
[QUIC_ST_DROPPED_PACKET_BUFOVERRUN] = { .name = "quic_dropped_pkt_bufoverrun",
.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_SENDTO_ERR_UNKNWN] = { .name = "quic_sendto_err_unknwn",
.desc = "Total number of error on sendto() calls not explicitly listed" },
[QUIC_ST_SENT_PACKET] = { .name = "quic_sent_pkt",
.desc = "Total number of sent packets" },
[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",
.desc = "Total number of too short dgrams with Initial 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_HALF_OPEN_CONN] = { .name = "quic_half_open_conn",
.desc = "Total number of half open connections" },
[QUIC_ST_HDSHK_FAIL] = { .name = "quic_hdshk_fail",
.desc = "Total number of handshake failures" },
[QUIC_ST_STATELESS_RESET_SENT] = { .name = "quic_stless_rst_sent",
.desc = "Total number of stateless reset packet sent" },
/* Special events of interest */
[QUIC_ST_CONN_MIGRATION_DONE] = { .name = "quic_conn_migration_done",
.desc = "Total number of connection migration proceeded" },
/* Transport errors */
[QUIC_ST_TRANSP_ERR_NO_ERROR] = { .name = "quic_transp_err_no_error",
.desc = "Total number of NO_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_INTERNAL_ERROR] = { .name = "quic_transp_err_internal_error",
.desc = "Total number of INTERNAL_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_CONNECTION_REFUSED] = { .name = "quic_transp_err_connection_refused",
.desc = "Total number of CONNECTION_REFUSED errors received" },
[QUIC_ST_TRANSP_ERR_FLOW_CONTROL_ERROR] = { .name = "quic_transp_err_flow_control_error",
.desc = "Total number of FLOW_CONTROL_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_STREAM_LIMIT_ERROR] = { .name = "quic_transp_err_stream_limit_error",
.desc = "Total number of STREAM_LIMIT_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_STREAM_STATE_ERROR] = { .name = "quic_transp_err_stream_state_error",
.desc = "Total number of STREAM_STATE_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_FINAL_SIZE_ERROR] = { .name = "quic_transp_err_final_size_error",
.desc = "Total number of FINAL_SIZE_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_FRAME_ENCODING_ERROR] = { .name = "quic_transp_err_frame_encoding_error",
.desc = "Total number of FRAME_ENCODING_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_TRANSPORT_PARAMETER_ERROR] = { .name = "quic_transp_err_transport_parameter_error",
.desc = "Total number of TRANSPORT_PARAMETER_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_CONNECTION_ID_LIMIT_ERROR] = { .name = "quic_transp_err_connection_id_limit",
.desc = "Total number of CONNECTION_ID_LIMIT_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_PROTOCOL_VIOLATION] = { .name = "quic_transp_err_protocol_violation_error",
.desc = "Total number of PROTOCOL_VIOLATION errors received" },
[QUIC_ST_TRANSP_ERR_INVALID_TOKEN] = { .name = "quic_transp_err_invalid_token",
.desc = "Total number of INVALID_TOKEN errors received" },
[QUIC_ST_TRANSP_ERR_APPLICATION_ERROR] = { .name = "quic_transp_err_application_error",
.desc = "Total number of APPLICATION_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_CRYPTO_BUFFER_EXCEEDED] = { .name = "quic_transp_err_crypto_buffer_exceeded",
.desc = "Total number of CRYPTO_BUFFER_EXCEEDED errors received" },
[QUIC_ST_TRANSP_ERR_KEY_UPDATE_ERROR] = { .name = "quic_transp_err_key_update_error",
.desc = "Total number of KEY_UPDATE_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_AEAD_LIMIT_REACHED] = { .name = "quic_transp_err_aead_limit_reached",
.desc = "Total number of AEAD_LIMIT_REACHED errors received" },
[QUIC_ST_TRANSP_ERR_NO_VIABLE_PATH] = { .name = "quic_transp_err_no_viable_path",
.desc = "Total number of NO_VIABLE_PATH errors received" },
[QUIC_ST_TRANSP_ERR_CRYPTO_ERROR] = { .name = "quic_transp_err_crypto_error",
.desc = "Total number of CRYPTO_ERROR errors received" },
[QUIC_ST_TRANSP_ERR_UNKNOWN_ERROR] = { .name = "quic_transp_err_unknown_error",
.desc = "Total number of UNKNOWN_ERROR errors received" },
/* Streams related counters */
[QUIC_ST_DATA_BLOCKED] = { .name = "quic_data_blocked",
.desc = "Total number of received DATA_BLOCKED frames" },
[QUIC_ST_STREAM_DATA_BLOCKED] = { .name = "quic_stream_data_blocked",
.desc = "Total number of received STREAM_DATA_BLOCKED frames" },
[QUIC_ST_STREAMS_BLOCKED_BIDI] = { .name = "quic_streams_blocked_bidi",
.desc = "Total number of received STREAMS_BLOCKED_BIDI frames" },
[QUIC_ST_STREAMS_BLOCKED_UNI] = { .name = "quic_streams_blocked_uni",
.desc = "Total number of received STREAMS_BLOCKED_UNI frames" },
};
struct quic_counters quic_counters;
static void quic_fill_stats(void *data, struct field *stats)
{
struct quic_counters *counters = data;
stats[QUIC_ST_RXBUF_FULL] = mkf_u64(FN_COUNTER, counters->rxbuf_full);
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_SENDTO_ERR_UNKNWN] = mkf_u64(FN_COUNTER, counters->sendto_err_unknown);
stats[QUIC_ST_SENT_PACKET] = mkf_u64(FN_COUNTER, counters->sent_pkt);
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);
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_HALF_OPEN_CONN] = mkf_u64(FN_GAUGE, counters->half_open_conn);
stats[QUIC_ST_HDSHK_FAIL] = mkf_u64(FN_COUNTER, counters->hdshk_fail);
stats[QUIC_ST_STATELESS_RESET_SENT] = mkf_u64(FN_COUNTER, counters->stateless_reset_sent);
/* Special events of interest */
stats[QUIC_ST_CONN_MIGRATION_DONE] = mkf_u64(FN_COUNTER, counters->conn_migration_done);
/* Transport errors */
stats[QUIC_ST_TRANSP_ERR_NO_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_no_error);
stats[QUIC_ST_TRANSP_ERR_INTERNAL_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_internal_error);
stats[QUIC_ST_TRANSP_ERR_CONNECTION_REFUSED] = mkf_u64(FN_COUNTER, counters->quic_transp_err_connection_refused);
stats[QUIC_ST_TRANSP_ERR_FLOW_CONTROL_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_flow_control_error);
stats[QUIC_ST_TRANSP_ERR_STREAM_LIMIT_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_stream_limit_error);
stats[QUIC_ST_TRANSP_ERR_STREAM_STATE_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_stream_state_error);
stats[QUIC_ST_TRANSP_ERR_FINAL_SIZE_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_final_size_error);
stats[QUIC_ST_TRANSP_ERR_FRAME_ENCODING_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_frame_encoding_error);
stats[QUIC_ST_TRANSP_ERR_TRANSPORT_PARAMETER_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_transport_parameter_error);
stats[QUIC_ST_TRANSP_ERR_CONNECTION_ID_LIMIT_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_connection_id_limit);
stats[QUIC_ST_TRANSP_ERR_PROTOCOL_VIOLATION] = mkf_u64(FN_COUNTER, counters->quic_transp_err_protocol_violation);
stats[QUIC_ST_TRANSP_ERR_INVALID_TOKEN] = mkf_u64(FN_COUNTER, counters->quic_transp_err_invalid_token);
stats[QUIC_ST_TRANSP_ERR_APPLICATION_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_application_error);
stats[QUIC_ST_TRANSP_ERR_CRYPTO_BUFFER_EXCEEDED] = mkf_u64(FN_COUNTER, counters->quic_transp_err_crypto_buffer_exceeded);
stats[QUIC_ST_TRANSP_ERR_KEY_UPDATE_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_key_update_error);
stats[QUIC_ST_TRANSP_ERR_AEAD_LIMIT_REACHED] = mkf_u64(FN_COUNTER, counters->quic_transp_err_aead_limit_reached);
stats[QUIC_ST_TRANSP_ERR_NO_VIABLE_PATH] = mkf_u64(FN_COUNTER, counters->quic_transp_err_no_viable_path);
stats[QUIC_ST_TRANSP_ERR_CRYPTO_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_crypto_error);
stats[QUIC_ST_TRANSP_ERR_UNKNOWN_ERROR] = mkf_u64(FN_COUNTER, counters->quic_transp_err_unknown_error);
/* 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_BLOCKED_BIDI] = mkf_u64(FN_COUNTER, counters->streams_blocked_bidi);
stats[QUIC_ST_STREAMS_BLOCKED_UNI] = mkf_u64(FN_COUNTER, counters->streams_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);
void quic_stats_transp_err_count_inc(struct quic_counters *ctrs, int error_code)
{
switch (error_code) {
case QC_ERR_NO_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_no_error);
break;
case QC_ERR_INTERNAL_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_internal_error);
break;
case QC_ERR_CONNECTION_REFUSED:
HA_ATOMIC_INC(&ctrs->quic_transp_err_connection_refused);
break;
case QC_ERR_FLOW_CONTROL_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_flow_control_error);
break;
case QC_ERR_STREAM_LIMIT_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_stream_limit_error);
break;
case QC_ERR_STREAM_STATE_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_stream_state_error);
break;
case QC_ERR_FINAL_SIZE_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_final_size_error);
break;
case QC_ERR_FRAME_ENCODING_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_frame_encoding_error);
break;
case QC_ERR_TRANSPORT_PARAMETER_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_transport_parameter_error);
break;
case QC_ERR_CONNECTION_ID_LIMIT_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_connection_id_limit);
break;
case QC_ERR_PROTOCOL_VIOLATION:
HA_ATOMIC_INC(&ctrs->quic_transp_err_protocol_violation);
break;
case QC_ERR_INVALID_TOKEN:
HA_ATOMIC_INC(&ctrs->quic_transp_err_invalid_token);
break;
case QC_ERR_APPLICATION_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_application_error);
break;
case QC_ERR_CRYPTO_BUFFER_EXCEEDED:
HA_ATOMIC_INC(&ctrs->quic_transp_err_crypto_buffer_exceeded);
break;
case QC_ERR_KEY_UPDATE_ERROR:
HA_ATOMIC_INC(&ctrs->quic_transp_err_key_update_error);
break;
case QC_ERR_AEAD_LIMIT_REACHED:
HA_ATOMIC_INC(&ctrs->quic_transp_err_aead_limit_reached);
break;
case QC_ERR_NO_VIABLE_PATH:
HA_ATOMIC_INC(&ctrs->quic_transp_err_no_viable_path);
break;
default:
if (error_code >= 0x100 && error_code <= 0x1ff)
HA_ATOMIC_INC(&ctrs->quic_transp_err_crypto_error);
else
HA_ATOMIC_INC(&ctrs->quic_transp_err_unknown_error);
}
}
|