Skip to content

Commit

Permalink
fix(s2n-quic-dc): Import fixes + new metrics (#2430)
Browse files Browse the repository at this point in the history
* Add new events for path secret map

* Import fixes for path secret map storage

This emits the metrics declared by the previous commit, and adjusts the
path secret map accessors to fix a bug:

This ensures that user-visible access to the ID map also populates the
peer map, which helps avoid getting stuck server-side where we can't
call handshake_with(...) but currently still need access by peer
address; we previously resolved the case where the entry is hidden by
requested_handshakes and this fixes where the entry is actually missing
due to conflict eviction.

* Bump entry size test due to adding accessed field
  • Loading branch information
Mark-Simulacrum authored Jan 2, 2025
1 parent a54686e commit 239a8d9
Show file tree
Hide file tree
Showing 11 changed files with 1,385 additions and 275 deletions.
72 changes: 72 additions & 0 deletions dc/s2n-quic-dc/events/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ struct PathSecretMapEntryReplaced<'a> {
previous_credential_id: &'a [u8],
}

#[event("path_secret_map:id_entry_evicted")]
#[subject(endpoint)]
/// Emitted when an entry is evicted due to running out of space
struct PathSecretMapIdEntryEvicted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
credential_id: &'a [u8],

/// Time since insertion of this entry
#[measure("age", Duration)]
age: core::time::Duration,
}

#[event("path_secret_map:addr_entry_evicted")]
#[subject(endpoint)]
/// Emitted when an entry is evicted due to running out of space
struct PathSecretMapAddressEntryEvicted<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[snapshot("[HIDDEN]")]
credential_id: &'a [u8],

/// Time since insertion of this entry
#[measure("age", Duration)]
age: core::time::Duration,
}

#[event("path_secret_map:unknown_path_secret_packet_sent")]
#[subject(endpoint)]
/// Emitted when an UnknownPathSecret packet was sent
Expand Down Expand Up @@ -295,6 +325,19 @@ struct PathSecretMapAddressCacheAccessed<'a> {
hit: bool,
}

#[event("path_secret_map:address_cache_accessed_entry")]
#[subject(endpoint)]
/// Emitted when the cache is accessed by peer address successfully
///
/// Provides more information about the accessed entry.
struct PathSecretMapAddressCacheAccessedHit<'a> {
#[nominal_counter("peer_address.protocol")]
peer_address: SocketAddress<'a>,

#[measure("age", Duration)]
age: core::time::Duration,
}

#[event("path_secret_map:id_cache_accessed")]
#[subject(endpoint)]
/// Emitted when the cache is accessed by path secret ID
Expand All @@ -308,6 +351,19 @@ struct PathSecretMapIdCacheAccessed<'a> {
hit: bool,
}

#[event("path_secret_map:id_cache_accessed_entry")]
#[subject(endpoint)]
/// Emitted when the cache is accessed by path secret ID successfully
///
/// Provides more information about the accessed entry.
struct PathSecretMapIdCacheAccessedHit<'a> {
#[snapshot("[HIDDEN]")]
credential_id: &'a [u8],

#[measure("age", Duration)]
age: core::time::Duration,
}

#[event("path_secret_map:cleaner_cycled")]
#[subject(endpoint)]
/// Emitted when the cleaner task performed a single cycle
Expand All @@ -322,6 +378,14 @@ struct PathSecretMapCleanerCycled {
#[measure("entries.id.retired")]
id_entries_retired: usize,

/// Count of entries accessed since the last cycle
#[measure("entries.id.active")]
id_entries_active: usize,

/// The utilization percentage of the active number of entries after the cycle
#[measure("entries.id.active.utilization", Percent)]
id_entries_active_utilization: f32,

/// The utilization percentage of the available number of entries after the cycle
#[measure("entries.id.utilization", Percent)]
id_entries_utilization: f32,
Expand All @@ -334,6 +398,14 @@ struct PathSecretMapCleanerCycled {
#[measure("entries.address")]
address_entries: usize,

/// Count of entries accessed since the last cycle
#[measure("entries.address.active")]
address_entries_active: usize,

/// The utilization percentage of the active number of entries after the cycle
#[measure("entries.address.active.utilization", Percent)]
address_entries_active_utilization: f32,

/// The number of SocketAddress entries that were retired in the cycle
#[measure("entries.address.retired")]
address_entries_retired: usize,
Expand Down
Loading

0 comments on commit 239a8d9

Please sign in to comment.