-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds more fields to connection stats #368
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,10 @@ struct st_quicly_conn_t { | |
} active_acked_cache; | ||
} on_ack_stream; | ||
} stash; | ||
/** | ||
* Start time of the connection. | ||
*/ | ||
int64_t conn_start_at; | ||
}; | ||
|
||
struct st_quicly_handle_payload_state_t { | ||
|
@@ -1097,6 +1101,18 @@ int quicly_get_stats(quicly_conn_t *conn, quicly_stats_t *stats) | |
/* set or generate the non-pre-built stats fields here */ | ||
stats->rtt = conn->egress.loss.rtt; | ||
stats->cc = conn->egress.cc; | ||
stats->duration = conn->stash.now - conn->conn_start_at; | ||
stats->version = conn->super.version; | ||
stats->max_udp_payload_size = conn->egress.max_udp_payload_size; | ||
|
||
stats->allowed_local_uni_streams = conn->egress.max_streams.uni.count; | ||
stats->opened_local_uni_streams = conn->super.local.uni.next_stream_id / 4; | ||
stats->allowed_local_bidi_streams = conn->egress.max_streams.bidi.count; | ||
stats->opened_local_bidi_streams = conn->super.local.bidi.next_stream_id / 4; | ||
stats->allowed_remote_uni_streams = conn->ingress.max_streams.uni.max_committed; | ||
stats->opened_remote_uni_streams = conn->super.remote.uni.next_stream_id / 4; | ||
stats->allowed_remote_bidi_streams = conn->ingress.max_streams.bidi.max_committed; | ||
stats->opened_remote_bidi_streams = conn->super.remote.bidi.next_stream_id / 4; | ||
return 0; | ||
} | ||
|
||
|
@@ -1253,6 +1269,13 @@ static int record_receipt(quicly_conn_t *conn, struct st_quicly_pn_space_t *spac | |
conn->egress.send_ack_at = conn->stash.now + QUICLY_DELAYED_ACK_TIMEOUT; | ||
} | ||
|
||
if (is_ack_only) | ||
++conn->super.stats.num_packets.ack_only_received; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems fine. |
||
if (epoch == QUICLY_EPOCH_INITIAL || epoch == QUICLY_EPOCH_HANDSHAKE) | ||
++conn->super.stats.num_packets.handshake_received; | ||
if (epoch == QUICLY_EPOCH_0RTT) | ||
++conn->super.stats.num_packets.zerortt_received; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is the correct location for updating the metrics. We update |
||
|
||
ret = 0; | ||
Exit: | ||
return ret; | ||
|
@@ -1865,6 +1888,7 @@ static quicly_conn_t *create_connection(quicly_context_t *ctx, const char *serve | |
memset(conn, 0, sizeof(*conn)); | ||
conn->super.ctx = ctx; | ||
lock_now(conn, 0); | ||
conn->conn_start_at = conn->stash.now; | ||
set_address(&conn->super.local.address, local_addr); | ||
set_address(&conn->super.remote.address, remote_addr); | ||
quicly_local_cid_init_set(&conn->super.local.cid_set, ctx->cid_encryptor, local_cid); | ||
|
@@ -2781,6 +2805,10 @@ static int commit_send_packet(quicly_conn_t *conn, quicly_send_context_t *s, enu | |
|
||
++conn->egress.packet_number; | ||
++conn->super.stats.num_packets.sent; | ||
if (get_epoch(*s->target.first_byte_at) == QUICLY_EPOCH_INITIAL || get_epoch(*s->target.first_byte_at) == QUICLY_EPOCH_HANDSHAKE) | ||
++conn->super.stats.num_packets.handshake_sent; | ||
if (get_epoch(*s->target.first_byte_at) == QUICLY_EPOCH_0RTT) | ||
++conn->super.stats.num_packets.zerortt_sent; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As stated above, maybe it would be better to change the type of |
||
|
||
if (mode != QUICLY_COMMIT_SEND_PACKET_MODE_COALESCED) { | ||
conn->super.stats.num_bytes.sent += datagram_size; | ||
|
@@ -3198,6 +3226,7 @@ int quicly_send_stream(quicly_stream_t *stream, quicly_send_context_t *s) | |
UpdateState: | ||
QUICLY_PROBE(STREAM_SEND, stream->conn, stream->conn->stash.now, stream, off, end_off - off, is_fin); | ||
QUICLY_PROBE(QUICTRACE_SEND_STREAM, stream->conn, stream->conn->stash.now, stream, off, end_off - off, is_fin); | ||
stream->conn->super.stats.num_bytes.stream_sent += end_off - off; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This metric would cover both the ordinary streams and CRYPTO streams, as we do not check the sign of the stream-id. Are we fine with that? I do not have a strong opinion but would like to confirm. |
||
/* update sendstate (and also MAX_DATA counter) */ | ||
if (stream->sendstate.size_inflight < end_off) { | ||
if (stream->stream_id >= 0) | ||
|
@@ -4278,6 +4307,7 @@ static int handle_stream_frame(quicly_conn_t *conn, struct st_quicly_handle_payl | |
if ((ret = quicly_decode_stream_frame(state->frame_type, &state->src, state->end, &frame)) != 0) | ||
return ret; | ||
QUICLY_PROBE(QUICTRACE_RECV_STREAM, conn, conn->stash.now, frame.stream_id, frame.offset, frame.data.len, (int)frame.is_fin); | ||
conn->super.stats.num_bytes.stream_received += frame.data.len; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here also. |
||
if ((ret = get_stream_or_open_if_new(conn, frame.stream_id, &stream)) != 0 || stream == NULL) | ||
return ret; | ||
return apply_stream_frame(stream, &frame); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"conn_" seems excessive to me, as this field is part of
quicly_conn_t
. Maybe rename tocreated_at
or something?