Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Nov 19, 2024
1 parent 6ed356b commit 43e8cb7
Show file tree
Hide file tree
Showing 11 changed files with 696 additions and 479 deletions.
20 changes: 19 additions & 1 deletion dc/s2n-quic-dc/events/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ struct AcceptorTcpStarted<'a> {
}

/// Emitted when a TCP acceptor completes a single iteration of the event loop
#[event("acceptor:tcp:started")]
#[event("acceptor:tcp:loop_iteration_completed")]
#[subject(endpoint)]
struct AcceptorTcpLoopIterationCompleted {
/// The number of streams that are waiting on initial packets
#[measure("pending_streams")]
pending_streams: usize,

/// The number of slots that are not currently processing a stream
#[measure("slots_idle")]
slots_idle: usize,

/// The percentage of slots currently processing streams
#[measure("slot_utilization", Percent)]
slot_utilization: f32,

/// The amount of time it took to complete the iteration
#[timer("processing_duration")]
processing_duration: core::time::Duration,
Expand Down Expand Up @@ -123,6 +131,10 @@ struct AcceptorTcpPacketReceived<'a> {
#[bool_counter("is_fin")]
is_fin: bool,

/// If the packet includes the final offset of the stream
#[bool_counter("is_fin_known")]
is_fin_known: bool,

/// The amount of time the TCP stream spent in the queue before receiving
/// the initial packet
#[timer("sojourn_time")]
Expand All @@ -138,6 +150,7 @@ struct AcceptorTcpPacketDropped<'a> {
remote_address: SocketAddress<'a>,

/// The reason the packet was dropped
#[nominal_counter("reason")]
reason: AcceptorPacketDropReason,

/// The amount of time the TCP stream spent in the queue before receiving
Expand Down Expand Up @@ -233,6 +246,10 @@ struct AcceptorUdpPacketReceived<'a> {
/// If the packet includes the final bytes of the stream
#[bool_counter("is_fin")]
is_fin: bool,

/// If the packet includes the final offset of the stream
#[bool_counter("is_fin_known")]
is_fin_known: bool,
}

/// Emitted when the UDP acceptor received an invalid initial packet
Expand All @@ -244,6 +261,7 @@ struct AcceptorUdpPacketDropped<'a> {
remote_address: SocketAddress<'a>,

/// The reason the packet was dropped
#[nominal_counter("reason")]
reason: AcceptorPacketDropReason,
}

Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/events/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct PathSecretMapBackgroundHandshakeRequested<'a> {
peer_address: SocketAddress<'a>,
}

#[event("path_secret_map:entry_replaced")]
#[event("path_secret_map:entry_inserted")]
#[subject(endpoint)]
/// Emitted when the entry is inserted into the path secret map
struct PathSecretMapEntryInserted<'a> {
Expand All @@ -43,7 +43,7 @@ struct PathSecretMapEntryInserted<'a> {
credential_id: &'a [u8],
}

#[event("path_secret_map:entry_replaced")]
#[event("path_secret_map:entry_ready")]
#[subject(endpoint)]
/// Emitted when the entry is considered ready for use
struct PathSecretMapEntryReady<'a> {
Expand Down
44 changes: 38 additions & 6 deletions dc/s2n-quic-dc/src/event/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub mod api {
pub struct AcceptorTcpLoopIterationCompleted {
#[doc = " The number of streams that are waiting on initial packets"]
pub pending_streams: usize,
#[doc = " The number of slots that are not currently processing a stream"]
pub slots_idle: usize,
#[doc = " The percentage of slots currently processing streams"]
pub slot_utilization: f32,
#[doc = " The amount of time it took to complete the iteration"]
pub processing_duration: core::time::Duration,
#[doc = " The computed max sojourn time that is allowed for streams"]
Expand All @@ -57,13 +61,15 @@ pub mod api {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
let mut fmt = fmt.debug_struct("AcceptorTcpLoopIterationCompleted");
fmt.field("pending_streams", &self.pending_streams);
fmt.field("slots_idle", &self.slots_idle);
fmt.field("slot_utilization", &self.slot_utilization);
fmt.field("processing_duration", &self.processing_duration);
fmt.field("max_sojourn_time", &self.max_sojourn_time);
fmt.finish()
}
}
impl Event for AcceptorTcpLoopIterationCompleted {
const NAME: &'static str = "acceptor:tcp:started";
const NAME: &'static str = "acceptor:tcp:loop_iteration_completed";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
Expand Down Expand Up @@ -166,6 +172,8 @@ pub mod api {
pub payload_len: usize,
#[doc = " If the packet includes the final bytes of the stream"]
pub is_fin: bool,
#[doc = " If the packet includes the final offset of the stream"]
pub is_fin_known: bool,
#[doc = " The amount of time the TCP stream spent in the queue before receiving"]
#[doc = " the initial packet"]
pub sojourn_time: core::time::Duration,
Expand All @@ -179,6 +187,7 @@ pub mod api {
fmt.field("stream_id", &self.stream_id);
fmt.field("payload_len", &self.payload_len);
fmt.field("is_fin", &self.is_fin);
fmt.field("is_fin_known", &self.is_fin_known);
fmt.field("sojourn_time", &self.sojourn_time);
fmt.finish()
}
Expand Down Expand Up @@ -319,6 +328,8 @@ pub mod api {
pub is_retransmission: bool,
#[doc = " If the packet includes the final bytes of the stream"]
pub is_fin: bool,
#[doc = " If the packet includes the final offset of the stream"]
pub is_fin_known: bool,
}
#[cfg(any(test, feature = "testing"))]
impl<'a> crate::event::snapshot::Fmt for AcceptorUdpPacketReceived<'a> {
Expand All @@ -331,6 +342,7 @@ pub mod api {
fmt.field("is_zero_offset", &self.is_zero_offset);
fmt.field("is_retransmission", &self.is_retransmission);
fmt.field("is_fin", &self.is_fin);
fmt.field("is_fin_known", &self.is_fin_known);
fmt.finish()
}
}
Expand Down Expand Up @@ -736,7 +748,7 @@ pub mod api {
}
}
impl<'a> Event for PathSecretMapEntryInserted<'a> {
const NAME: &'static str = "path_secret_map:entry_replaced";
const NAME: &'static str = "path_secret_map:entry_inserted";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
Expand All @@ -755,7 +767,7 @@ pub mod api {
}
}
impl<'a> Event for PathSecretMapEntryReady<'a> {
const NAME: &'static str = "path_secret_map:entry_replaced";
const NAME: &'static str = "path_secret_map:entry_ready";
}
#[derive(Clone, Debug)]
#[non_exhaustive]
Expand Down Expand Up @@ -1171,10 +1183,12 @@ pub mod tracing {
let parent = self.parent(meta);
let api::AcceptorTcpLoopIterationCompleted {
pending_streams,
slots_idle,
slot_utilization,
processing_duration,
max_sojourn_time,
} = event;
tracing :: event ! (target : "acceptor_tcp_loop_iteration_completed" , parent : parent , tracing :: Level :: DEBUG , pending_streams = tracing :: field :: debug (pending_streams) , processing_duration = tracing :: field :: debug (processing_duration) , max_sojourn_time = tracing :: field :: debug (max_sojourn_time));
tracing :: event ! (target : "acceptor_tcp_loop_iteration_completed" , parent : parent , tracing :: Level :: DEBUG , pending_streams = tracing :: field :: debug (pending_streams) , slots_idle = tracing :: field :: debug (slots_idle) , slot_utilization = tracing :: field :: debug (slot_utilization) , processing_duration = tracing :: field :: debug (processing_duration) , max_sojourn_time = tracing :: field :: debug (max_sojourn_time));
}
#[inline]
fn on_acceptor_tcp_fresh_enqueued(
Expand Down Expand Up @@ -1240,9 +1254,10 @@ pub mod tracing {
stream_id,
payload_len,
is_fin,
is_fin_known,
sojourn_time,
} = event;
tracing :: event ! (target : "acceptor_tcp_packet_received" , parent : parent , tracing :: Level :: DEBUG , remote_address = tracing :: field :: debug (remote_address) , credential_id = tracing :: field :: debug (credential_id) , stream_id = tracing :: field :: debug (stream_id) , payload_len = tracing :: field :: debug (payload_len) , is_fin = tracing :: field :: debug (is_fin) , sojourn_time = tracing :: field :: debug (sojourn_time));
tracing :: event ! (target : "acceptor_tcp_packet_received" , parent : parent , tracing :: Level :: DEBUG , remote_address = tracing :: field :: debug (remote_address) , credential_id = tracing :: field :: debug (credential_id) , stream_id = tracing :: field :: debug (stream_id) , payload_len = tracing :: field :: debug (payload_len) , is_fin = tracing :: field :: debug (is_fin) , is_fin_known = tracing :: field :: debug (is_fin_known) , sojourn_time = tracing :: field :: debug (sojourn_time));
}
#[inline]
fn on_acceptor_tcp_packet_dropped(
Expand Down Expand Up @@ -1322,8 +1337,9 @@ pub mod tracing {
is_zero_offset,
is_retransmission,
is_fin,
is_fin_known,
} = event;
tracing :: event ! (target : "acceptor_udp_packet_received" , parent : parent , tracing :: Level :: DEBUG , remote_address = tracing :: field :: debug (remote_address) , credential_id = tracing :: field :: debug (credential_id) , stream_id = tracing :: field :: debug (stream_id) , payload_len = tracing :: field :: debug (payload_len) , is_zero_offset = tracing :: field :: debug (is_zero_offset) , is_retransmission = tracing :: field :: debug (is_retransmission) , is_fin = tracing :: field :: debug (is_fin));
tracing :: event ! (target : "acceptor_udp_packet_received" , parent : parent , tracing :: Level :: DEBUG , remote_address = tracing :: field :: debug (remote_address) , credential_id = tracing :: field :: debug (credential_id) , stream_id = tracing :: field :: debug (stream_id) , payload_len = tracing :: field :: debug (payload_len) , is_zero_offset = tracing :: field :: debug (is_zero_offset) , is_retransmission = tracing :: field :: debug (is_retransmission) , is_fin = tracing :: field :: debug (is_fin) , is_fin_known = tracing :: field :: debug (is_fin_known));
}
#[inline]
fn on_acceptor_udp_packet_dropped(
Expand Down Expand Up @@ -1765,6 +1781,10 @@ pub mod builder {
pub struct AcceptorTcpLoopIterationCompleted {
#[doc = " The number of streams that are waiting on initial packets"]
pub pending_streams: usize,
#[doc = " The number of slots that are not currently processing a stream"]
pub slots_idle: usize,
#[doc = " The percentage of slots currently processing streams"]
pub slot_utilization: f32,
#[doc = " The amount of time it took to complete the iteration"]
pub processing_duration: core::time::Duration,
#[doc = " The computed max sojourn time that is allowed for streams"]
Expand All @@ -1778,11 +1798,15 @@ pub mod builder {
fn into_event(self) -> api::AcceptorTcpLoopIterationCompleted {
let AcceptorTcpLoopIterationCompleted {
pending_streams,
slots_idle,
slot_utilization,
processing_duration,
max_sojourn_time,
} = self;
api::AcceptorTcpLoopIterationCompleted {
pending_streams: pending_streams.into_event(),
slots_idle: slots_idle.into_event(),
slot_utilization: slot_utilization.into_event(),
processing_duration: processing_duration.into_event(),
max_sojourn_time: max_sojourn_time.into_event(),
}
Expand Down Expand Up @@ -1887,6 +1911,8 @@ pub mod builder {
pub payload_len: usize,
#[doc = " If the packet includes the final bytes of the stream"]
pub is_fin: bool,
#[doc = " If the packet includes the final offset of the stream"]
pub is_fin_known: bool,
#[doc = " The amount of time the TCP stream spent in the queue before receiving"]
#[doc = " the initial packet"]
pub sojourn_time: core::time::Duration,
Expand All @@ -1900,6 +1926,7 @@ pub mod builder {
stream_id,
payload_len,
is_fin,
is_fin_known,
sojourn_time,
} = self;
api::AcceptorTcpPacketReceived {
Expand All @@ -1908,6 +1935,7 @@ pub mod builder {
stream_id: stream_id.into_event(),
payload_len: payload_len.into_event(),
is_fin: is_fin.into_event(),
is_fin_known: is_fin_known.into_event(),
sojourn_time: sojourn_time.into_event(),
}
}
Expand Down Expand Up @@ -2042,6 +2070,8 @@ pub mod builder {
pub is_retransmission: bool,
#[doc = " If the packet includes the final bytes of the stream"]
pub is_fin: bool,
#[doc = " If the packet includes the final offset of the stream"]
pub is_fin_known: bool,
}
impl<'a> IntoEvent<api::AcceptorUdpPacketReceived<'a>> for AcceptorUdpPacketReceived<'a> {
#[inline]
Expand All @@ -2054,6 +2084,7 @@ pub mod builder {
is_zero_offset,
is_retransmission,
is_fin,
is_fin_known,
} = self;
api::AcceptorUdpPacketReceived {
remote_address: remote_address.into_event(),
Expand All @@ -2063,6 +2094,7 @@ pub mod builder {
is_zero_offset: is_zero_offset.into_event(),
is_retransmission: is_retransmission.into_event(),
is_fin: is_fin.into_event(),
is_fin_known: is_fin_known.into_event(),
}
}
}
Expand Down
Loading

0 comments on commit 43e8cb7

Please sign in to comment.