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

feat(s2n-quic-dc): emit top-level stream events #2394

Merged
merged 1 commit into from
Dec 3, 2024
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
209 changes: 201 additions & 8 deletions dc/s2n-quic-dc/events/connection.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,219 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#[event("application:write")]
pub struct ApplicationWrite {
#[event("stream:write_flushed")]
#[checkpoint("latency")]
pub struct StreamWriteFlushed {
/// The number of bytes that the application tried to write
#[measure("provided", Bytes)]
total_len: usize,
provided_len: usize,

/// The amount that was written
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
write_len: usize,
committed_len: usize,

/// The amount of time it took to process the write request
///
/// Note that this includes both any syscall and encryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,
}

#[event("stream:write_fin_flushed")]
#[checkpoint("latency")]
pub struct StreamWriteFinFlushed {
/// The number of bytes that the application tried to write
#[measure("provided", Bytes)]
provided_len: usize,

/// The amount that was written
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
committed_len: usize,

/// The amount of time it took to process the write request
///
/// Note that this includes both any syscall and encryption overhead
#[measure("processing_duration", Duration)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is OK for now, but I wonder if we should have a duration_per_byte or something like that, to make it easier to actually make sense of what this means.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that could be an interesting metric to have. i can add that as a follow-up

processing_duration: core::time::Duration,
}

#[event("stream:write_blocked")]
#[checkpoint("latency")]
pub struct StreamWriteBlocked {
/// The number of bytes that the application tried to write
#[measure("provided", Bytes)]
provided_len: usize,

/// Indicates that the write was the final offset of the stream
is_fin: bool,

/// The amount of time it took to process the write request
///
/// Note that this includes both any syscall and encryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,
}

#[event("stream:write_errored")]
#[checkpoint("latency")]
pub struct StreamWriteErrored {
/// The number of bytes that the application tried to write
#[measure("provided", Bytes)]
provided_len: usize,

/// Indicates that the write was the final offset of the stream
is_fin: bool,

/// The amount of time it took to process the write request
///
/// Note that this includes both any syscall and encryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,

/// The system `errno` from the returned error
errno: Option<i32>,
}

#[event("stream:write_shutdown")]
#[checkpoint("latency")]
pub struct StreamWriteShutdown {
/// The number of bytes in the send buffer at the time of shutdown
#[measure("buffer_len", Bytes)]
buffer_len: usize,

/// If the stream required a background task to drive the stream shutdown
#[bool_counter("background")]
background: bool,
}

#[event("stream:write_socket_flushed")]
pub struct StreamWriteSocketFlushed {
/// The number of bytes that the stream tried to write to the socket
#[measure("provided", Bytes)]
provided_len: usize,

/// The amount that was written
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
committed_len: usize,
}

#[event("stream:write_socket_blocked")]
pub struct StreamWriteSocketBlocked {
/// The number of bytes that the stream tried to write to the socket
#[measure("provided", Bytes)]
provided_len: usize,
}

#[event("stream:write_socket_errored")]
pub struct StreamWriteSocketErrored {
/// The number of bytes that the stream tried to write to the socket
#[measure("provided", Bytes)]
provided_len: usize,

/// The system `errno` from the returned error
errno: Option<i32>,
}

#[event("application:read")]
pub struct ApplicationRead {
#[event("stream:read_flushed")]
#[checkpoint("latency")]
pub struct StreamReadFlushed {
/// The number of bytes that the application tried to read
#[measure("capacity", Bytes)]
capacity: usize,

/// The amount that was read
/// The amount that was read into the provided buffer
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
read_len: usize,
committed_len: usize,

/// The amount of time it took to process the read request
///
/// Note that this includes both any syscall and decryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,
}

#[event("stream:read_fin_flushed")]
#[checkpoint("latency")]
pub struct StreamReadFinFlushed {
/// The number of bytes that the application tried to read
#[measure("capacity", Bytes)]
capacity: usize,

/// The amount of time it took to process the read request
///
/// Note that this includes both any syscall and decryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,
}

#[event("stream:read_blocked")]
#[checkpoint("latency")]
pub struct StreamReadBlocked {
/// The number of bytes that the application tried to read
#[measure("capacity", Bytes)]
capacity: usize,

/// The amount of time it took to process the read request
///
/// Note that this includes both any syscall and decryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,
}

#[event("stream:read_errored")]
#[checkpoint("latency")]
pub struct StreamReadErrored {
/// The number of bytes that the application tried to read
#[measure("capacity", Bytes)]
capacity: usize,

/// The amount of time it took to process the read request
///
/// Note that this includes both any syscall and decryption overhead
#[measure("processing_duration", Duration)]
processing_duration: core::time::Duration,

/// The system `errno` from the returned error
errno: Option<i32>,
}

#[event("stream:read_shutdown")]
#[checkpoint("latency")]
pub struct StreamReadShutdown {
/// If the stream required a background task to drive the stream shutdown
#[bool_counter("background")]
background: bool,
}

#[event("stream:read_socket_flushed")]
pub struct StreamReadSocketFlushed {
/// The number of bytes that the stream tried to read from the socket
#[measure("capacity", Bytes)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This buffer is always an internal buffer IIRC, right? Do we expect meaningful size differences on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's always an internal buffer. I was curious to see if we were ever needing to read more for stream sockets to complete a packet, in which case this buffer would be undersized.

capacity: usize,

/// The amount that was read into the provided buffer
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
committed_len: usize,
}

#[event("stream:read_socket_blocked")]
pub struct StreamReadSocketBlocked {
/// The number of bytes that the stream tried to read from the socket
#[measure("capacity", Bytes)]
capacity: usize,
}

#[event("stream:read_socket_errored")]
pub struct StreamReadSocketErrored {
/// The number of bytes that the stream tried to read from the socket
#[measure("capacity", Bytes)]
capacity: usize,

/// The system `errno` from the returned error
errno: Option<i32>,
}
Loading
Loading