Skip to content

Commit

Permalink
feat(s2n-quic-core): add nominal counter aggregations (#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Nov 7, 2024
1 parent c7cf090 commit cfd87b9
Show file tree
Hide file tree
Showing 27 changed files with 4,949 additions and 1,001 deletions.
12 changes: 6 additions & 6 deletions dc/s2n-quic-dc/events/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
#[event("application:write")]
pub struct ApplicationWrite {
/// The number of bytes that the application tried to write
#[measure("provided", "b")]
#[measure("provided", Bytes)]
total_len: usize,

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

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

/// The amount that was read
#[measure("committed", "b")]
#[counter("committed.total", "b")]
#[measure("committed", Bytes)]
#[counter("committed.total", Bytes)]
read_len: usize,
}
4 changes: 4 additions & 0 deletions dc/s2n-quic-dc/events/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
#[event("endpoint:initialized")]
#[subject(endpoint)]
struct EndpointInitialized<'a> {
#[nominal_counter("acceptor.protocol")]
acceptor_addr: SocketAddress<'a>,
#[nominal_counter("handshake.protocol")]
handshake_addr: SocketAddress<'a>,
#[bool_counter("tcp")]
tcp: bool,
#[bool_counter("udp")]
udp: bool,
}
19 changes: 19 additions & 0 deletions dc/s2n-quic-dc/events/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ struct PathSecretMapUninitialized {
#[subject(endpoint)]
/// Emitted when a background handshake is requested
struct PathSecretMapBackgroundHandshakeRequested<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,
}

#[event("path_secret_map:entry_replaced")]
#[subject(endpoint)]
/// Emitted when the entry is inserted into the path secret map
struct PathSecretMapEntryInserted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -42,6 +44,7 @@ struct PathSecretMapEntryInserted<'a> {
#[subject(endpoint)]
/// Emitted when the entry is considered ready for use
struct PathSecretMapEntryReady<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -52,6 +55,7 @@ struct PathSecretMapEntryReady<'a> {
#[subject(endpoint)]
/// Emitted when an entry is replaced by a new one for the same `peer_address`
struct PathSecretMapEntryReplaced<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -65,6 +69,7 @@ struct PathSecretMapEntryReplaced<'a> {
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was sent
struct UnknownPathSecretPacketSent<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -75,6 +80,7 @@ struct UnknownPathSecretPacketSent<'a> {
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was received
struct UnknownPathSecretPacketReceived<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -85,6 +91,7 @@ struct UnknownPathSecretPacketReceived<'a> {
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was authentic and processed
struct UnknownPathSecretPacketAccepted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -95,6 +102,7 @@ struct UnknownPathSecretPacketAccepted<'a> {
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was rejected as invalid
struct UnknownPathSecretPacketRejected<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -105,6 +113,7 @@ struct UnknownPathSecretPacketRejected<'a> {
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was dropped due to a missing entry
struct UnknownPathSecretPacketDropped<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand Down Expand Up @@ -139,6 +148,7 @@ struct ReplayPotentiallyDetected<'a> {
#[subject(endpoint)]
/// Emitted when an ReplayDetected packet was sent
struct ReplayDetectedPacketSent<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -149,6 +159,7 @@ struct ReplayDetectedPacketSent<'a> {
#[subject(endpoint)]
/// Emitted when an ReplayDetected packet was received
struct ReplayDetectedPacketReceived<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -159,6 +170,7 @@ struct ReplayDetectedPacketReceived<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was authentic and processed
struct ReplayDetectedPacketAccepted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -171,6 +183,7 @@ struct ReplayDetectedPacketAccepted<'a> {
#[subject(endpoint)]
/// Emitted when an ReplayDetected packet was rejected as invalid
struct ReplayDetectedPacketRejected<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -181,6 +194,7 @@ struct ReplayDetectedPacketRejected<'a> {
#[subject(endpoint)]
/// Emitted when an ReplayDetected packet was dropped due to a missing entry
struct ReplayDetectedPacketDropped<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -191,6 +205,7 @@ struct ReplayDetectedPacketDropped<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was sent
struct StaleKeyPacketSent<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -201,6 +216,7 @@ struct StaleKeyPacketSent<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was received
struct StaleKeyPacketReceived<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -211,6 +227,7 @@ struct StaleKeyPacketReceived<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was authentic and processed
struct StaleKeyPacketAccepted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -221,6 +238,7 @@ struct StaleKeyPacketAccepted<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was rejected as invalid
struct StaleKeyPacketRejected<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand All @@ -231,6 +249,7 @@ struct StaleKeyPacketRejected<'a> {
#[subject(endpoint)]
/// Emitted when an StaleKey packet was dropped due to a missing entry
struct StaleKeyPacketDropped<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub mod metrics {
pub mod aggregate {
pub use crate::event::generated::metrics::aggregate::*;
pub use s2n_quic_core::event::metrics::aggregate::{
info, AsMetric, Info, Recorder, Registry,
info, AsVariant, BoolRecorder, Info, Metric, NominalRecorder, Recorder, Registry, Units,
};

pub mod probe {
Expand Down
2 changes: 2 additions & 0 deletions dc/s2n-quic-dc/src/event/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub(crate) mod metrics;
pub mod api {
#![doc = r" This module contains events that are emitted to the [`Subscriber`](crate::event::Subscriber)"]
use super::*;
#[allow(unused_imports)]
use crate::event::metrics::aggregate;
pub use s2n_quic_core::event::api::{EndpointType, SocketAddress, Subject};
pub use traits::Subscriber;
#[derive(Clone, Debug)]
Expand Down
Loading

0 comments on commit cfd87b9

Please sign in to comment.