Skip to content
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

emit payload and the wrote_all flag as part of the stream_send probe #605

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions lib/quicly.c
Original file line number Diff line number Diff line change
Expand Up @@ -2143,11 +2143,13 @@ static quicly_error_t apply_stream_frame(quicly_stream_t *stream, quicly_stream_
{
quicly_error_t ret;

QUICLY_PROBE(STREAM_RECEIVE, stream->conn, stream->conn->stash.now, stream, frame->offset, frame->data.len);
QUICLY_PROBE(STREAM_RECEIVE, stream->conn, stream->conn->stash.now, stream, frame->offset, frame->data.base, frame->data.len,
(int)frame->is_fin);
QUICLY_LOG_CONN(stream_receive, stream->conn, {
PTLS_LOG_ELEMENT_SIGNED(stream_id, stream->stream_id);
PTLS_LOG_ELEMENT_UNSIGNED(off, frame->offset);
PTLS_LOG_ELEMENT_UNSIGNED(len, frame->data.len);
PTLS_LOG_APPDATA_ELEMENT_HEXDUMP(data, frame->data.base, frame->data.len);
PTLS_LOG_ELEMENT_BOOL(is_fin, frame->is_fin);
});

if (quicly_recvstate_transfer_complete(&stream->recvstate))
Expand Down Expand Up @@ -2182,14 +2184,15 @@ static quicly_error_t apply_stream_frame(quicly_stream_t *stream, quicly_stream_

if (apply_len != 0 || quicly_recvstate_transfer_complete(&stream->recvstate)) {
uint64_t buf_offset = frame->offset + frame->data.len - apply_len - stream->recvstate.data_off;
const void *apply_src = frame->data.base + frame->data.len - apply_len;
QUICLY_PROBE(STREAM_ON_RECEIVE, stream->conn, stream->conn->stash.now, stream, (size_t)buf_offset, apply_src, apply_len);
size_t apply_off = frame->data.len - apply_len;
QUICLY_PROBE(STREAM_ON_RECEIVE, stream->conn, stream->conn->stash.now, stream, (size_t)buf_offset, apply_off, apply_len);
QUICLY_LOG_CONN(stream_on_receive, stream->conn, {
PTLS_LOG_ELEMENT_SIGNED(stream_id, stream->stream_id);
PTLS_LOG_ELEMENT_UNSIGNED(off, buf_offset);
PTLS_LOG_APPDATA_ELEMENT_HEXDUMP(src, apply_src, apply_len);
PTLS_LOG_ELEMENT_UNSIGNED(buf_off, buf_offset);
PTLS_LOG_ELEMENT_UNSIGNED(apply_off, apply_off);
PTLS_LOG_ELEMENT_UNSIGNED(apply_len, apply_len);
});
stream->callbacks->on_receive(stream, (size_t)buf_offset, apply_src, apply_len);
stream->callbacks->on_receive(stream, (size_t)buf_offset, frame->data.base + apply_off, apply_len);
if (stream->conn->super.state >= QUICLY_STATE_CLOSING)
return QUICLY_ERROR_IS_CLOSING;
}
Expand Down Expand Up @@ -4361,12 +4364,13 @@ quicly_error_t quicly_send_stream(quicly_stream_t *stream, quicly_send_context_t
if (off < stream->sendstate.size_inflight)
stream->conn->super.stats.num_bytes.stream_data_resent +=
(stream->sendstate.size_inflight < off + len ? stream->sendstate.size_inflight : off + len) - off;
QUICLY_PROBE(STREAM_SEND, stream->conn, stream->conn->stash.now, stream, off, len, is_fin);
QUICLY_PROBE(STREAM_SEND, stream->conn, stream->conn->stash.now, stream, off, s->dst - len, len, is_fin, wrote_all);
QUICLY_LOG_CONN(stream_send, stream->conn, {
PTLS_LOG_ELEMENT_SIGNED(stream_id, stream->stream_id);
PTLS_LOG_ELEMENT_UNSIGNED(off, off);
PTLS_LOG_ELEMENT_UNSIGNED(len, len);
PTLS_LOG_APPDATA_ELEMENT_HEXDUMP(data, s->dst - len, len);
PTLS_LOG_ELEMENT_BOOL(is_fin, is_fin);
PTLS_LOG_ELEMENT_BOOL(wrote_all, wrote_all);
});

QUICLY_PROBE(QUICTRACE_SEND_STREAM, stream->conn, stream->conn->stash.now, stream, off, len, is_fin);
Expand Down
4 changes: 2 additions & 2 deletions misc/qlog-adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def handle_stream_receive(event):
return {
"frame_type": label,
"stream_id": event["stream-id"],
"length": event["len"],
"length": len(event["data"]) / 2 if "data" in event else event["data-len"],
"offset": event["off"]
}

Expand All @@ -260,7 +260,7 @@ def handle_stream_send(event):
return {
"frame_type": label,
"stream_id": event["stream-id"],
"length": event["len"],
"length": len(event["data"]) / 2 if "data" in event else event["data-len"],
"offset": event["off"]
}

Expand Down
11 changes: 6 additions & 5 deletions quicly-probes.d
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ provider quicly {
probe application_close_send(struct st_quicly_conn_t *conn, int64_t at, uint64_t error_code, const char *reason_phrase);
probe application_close_receive(struct st_quicly_conn_t *conn, int64_t at, uint64_t error_code, const char *reason_phrase);

probe stream_send(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, uint64_t off, size_t len,
int is_fin);
probe stream_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, uint64_t off, size_t len);
probe stream_send(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, uint64_t off, const void *data,
size_t data_len, int is_fin, int wrote_all);
probe stream_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, uint64_t off,
const void *data, size_t data_len, int is_fin);
probe stream_acked(struct st_quicly_conn_t *conn, int64_t at, int64_t stream_id, uint64_t off, size_t len);
probe stream_lost(struct st_quicly_conn_t *conn, int64_t at, int64_t stream_id, uint64_t off, size_t len);

Expand Down Expand Up @@ -158,8 +159,8 @@ provider quicly {
probe stream_on_send_emit(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t off,
size_t capacity);
probe stream_on_send_stop(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, int64_t err);
probe stream_on_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t off,
const void *src, size_t src_len);
probe stream_on_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t buf_off,
size_t apply_off, size_t apply_len);
probe stream_on_receive_reset(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, int64_t err);

probe enter_cc_limited(struct st_quicly_conn_t *conn, int64_t at, uint64_t pn);
Expand Down