Skip to content
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
28 changes: 25 additions & 3 deletions dc/s2n-quic-dc/events/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,34 @@ struct AcceptorTcpIoError<'a> {
/// The error encountered
#[builder(&'a std::io::Error)]
error: &'a std::io::Error,

#[nominal_counter("source")]
source: AcceptorTcpIoErrorSource,
}

enum AcceptorTcpIoErrorSource {
/// Problem during accept of the TCP socket
Accept,
/// Problem writing to the TCP socket
Send,
/// Kernel originating from sending the TCP socket over UDS
UnixSend,
/// Problem reading from the TCP socket
Recv,
/// Something within dcQUIC failed related to the remote state or network contents (e.g.,
/// parsing the packet)
Remote,
/// Something in the local application state was wrong (e.g., missing credentials).
Local,
/// Something went wrong that we didn't expect to happen.
/// This is used for failures that aren't expected to relate to dcQUIC state at all.
System,
}

/// Emitted when the TCP stream has been sent over a Unix domain socket
#[event("acceptor:tcp:socket_sent")]
#[subject(endpoint)]
struct AcceptorTcpSocketSent<'a> {
struct AcceptorTcpSocketSent<'a> {
/// The credential ID of the stream
#[snapshot("[HIDDEN]")]
credential_id: &'a [u8],
Expand All @@ -220,11 +242,11 @@ struct AcceptorTcpSocketSent<'a> {
/// Emitted when a TCP stream has been received from a Unix domain socket
#[event("acceptor:tcp:socket_received")]
#[subject(endpoint)]
struct AcceptorTcpSocketReceived<'a> {
struct AcceptorTcpSocketReceived<'a> {
/// The address of the stream's peer
#[builder(&'a s2n_quic_core::inet::SocketAddress)]
remote_address: SocketAddress<'a>,

/// The credential ID of the stream
#[snapshot("[HIDDEN]")]
credential_id: &'a [u8],
Expand Down
122 changes: 119 additions & 3 deletions dc/s2n-quic-dc/src/event/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,14 @@ pub mod api {
pub struct AcceptorTcpIoError<'a> {
#[doc = " The error encountered"]
pub error: &'a std::io::Error,
pub source: AcceptorTcpIoErrorSource,
}
#[cfg(any(test, feature = "testing"))]
impl<'a> crate::event::snapshot::Fmt for AcceptorTcpIoError<'a> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
let mut fmt = fmt.debug_struct("AcceptorTcpIoError");
fmt.field("error", &self.error);
fmt.field("source", &self.source);
fmt.finish()
}
}
Expand Down Expand Up @@ -564,6 +566,84 @@ pub mod api {
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum AcceptorTcpIoErrorSource {
#[non_exhaustive]
#[doc = " Problem during accept of the TCP socket"]
Accept {},
#[non_exhaustive]
#[doc = " Problem writing to the TCP socket"]
Send {},
#[non_exhaustive]
#[doc = " Kernel originating from sending the TCP socket over UDS"]
UnixSend {},
#[non_exhaustive]
#[doc = " Problem reading from the TCP socket"]
Recv {},
#[non_exhaustive]
#[doc = " Something within dcQUIC failed related to the remote state or network contents (e.g.,"]
#[doc = " parsing the packet)"]
Remote {},
#[non_exhaustive]
#[doc = " Something in the local application state was wrong (e.g., missing credentials)."]
Local {},
#[non_exhaustive]
#[doc = " Something went wrong that we didn't expect to happen."]
#[doc = " This is used for failures that aren't expected to relate to dcQUIC state at all."]
System {},
}
impl aggregate::AsVariant for AcceptorTcpIoErrorSource {
const VARIANTS: &'static [aggregate::info::Variant] = &[
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("ACCEPT\0"),
id: 0usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("SEND\0"),
id: 1usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("UNIX_SEND\0"),
id: 2usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("RECV\0"),
id: 3usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("REMOTE\0"),
id: 4usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("LOCAL\0"),
id: 5usize,
}
.build(),
aggregate::info::variant::Builder {
name: aggregate::info::Str::new("SYSTEM\0"),
id: 6usize,
}
.build(),
];
#[inline]
fn variant_idx(&self) -> usize {
match self {
Self::Accept { .. } => 0usize,
Self::Send { .. } => 1usize,
Self::UnixSend { .. } => 2usize,
Self::Recv { .. } => 3usize,
Self::Remote { .. } => 4usize,
Self::Local { .. } => 5usize,
Self::System { .. } => 6usize,
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum AcceptorStreamPruneReason {
#[non_exhaustive]
MaxSojournTimeExceeded {},
Expand Down Expand Up @@ -2469,8 +2549,8 @@ pub mod tracing {
event: &api::AcceptorTcpIoError,
) {
let parent = self.parent(meta);
let api::AcceptorTcpIoError { error } = event;
tracing :: event ! (target : "acceptor_tcp_io_error" , parent : parent , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) });
let api::AcceptorTcpIoError { error, source } = event;
tracing :: event ! (target : "acceptor_tcp_io_error" , parent : parent , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) , source = tracing :: field :: debug (source) });
}
#[inline]
fn on_acceptor_tcp_socket_sent(
Expand Down Expand Up @@ -3787,13 +3867,15 @@ pub mod builder {
pub struct AcceptorTcpIoError<'a> {
#[doc = " The error encountered"]
pub error: &'a std::io::Error,
pub source: AcceptorTcpIoErrorSource,
}
impl<'a> IntoEvent<api::AcceptorTcpIoError<'a>> for AcceptorTcpIoError<'a> {
#[inline]
fn into_event(self) -> api::AcceptorTcpIoError<'a> {
let AcceptorTcpIoError { error } = self;
let AcceptorTcpIoError { error, source } = self;
api::AcceptorTcpIoError {
error: error.into_event(),
source: source.into_event(),
}
}
}
Expand Down Expand Up @@ -4089,6 +4171,40 @@ pub mod builder {
}
}
#[derive(Clone, Debug)]
pub enum AcceptorTcpIoErrorSource {
#[doc = " Problem during accept of the TCP socket"]
Accept,
#[doc = " Problem writing to the TCP socket"]
Send,
#[doc = " Kernel originating from sending the TCP socket over UDS"]
UnixSend,
#[doc = " Problem reading from the TCP socket"]
Recv,
#[doc = " Something within dcQUIC failed related to the remote state or network contents (e.g.,"]
#[doc = " parsing the packet)"]
Remote,
#[doc = " Something in the local application state was wrong (e.g., missing credentials)."]
Local,
#[doc = " Something went wrong that we didn't expect to happen."]
#[doc = " This is used for failures that aren't expected to relate to dcQUIC state at all."]
System,
}
impl IntoEvent<api::AcceptorTcpIoErrorSource> for AcceptorTcpIoErrorSource {
#[inline]
fn into_event(self) -> api::AcceptorTcpIoErrorSource {
use api::AcceptorTcpIoErrorSource::*;
match self {
Self::Accept => Accept {},
Self::Send => Send {},
Self::UnixSend => UnixSend {},
Self::Recv => Recv {},
Self::Remote => Remote {},
Self::Local => Local {},
Self::System => System {},
}
}
}
#[derive(Clone, Debug)]
pub enum AcceptorStreamPruneReason {
MaxSojournTimeExceeded,
AcceptQueueCapacityExceeded,
Expand Down
Loading
Loading