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

Metric for forward gaps in key ID tracking #2382

Merged
merged 1 commit into from
Nov 20, 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
10 changes: 9 additions & 1 deletion dc/s2n-quic-dc/events/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,17 @@ struct KeyAccepted<'a> {

key_id: u64,

/// How far away this credential is from the leading edge of key IDs.
/// How far away this credential is from the leading edge of key IDs (after updating the edge).
///
/// Zero if this shifted us forward.
#[measure("gap")]
gap: u64,

/// How far away this credential is from the leading edge of key IDs (before updating the edge).
///
/// Zero if this didn't change the leading edge.
#[measure("forward_shift")]
forward_shift: u64,
}

#[event("path_secret_map:replay_definitely_detected")]
Expand Down
22 changes: 19 additions & 3 deletions dc/s2n-quic-dc/src/event/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,14 @@ pub mod api {
pub struct KeyAccepted<'a> {
pub credential_id: &'a [u8],
pub key_id: u64,
#[doc = " How far away this credential is from the leading edge of key IDs."]
#[doc = " How far away this credential is from the leading edge of key IDs (after updating the edge)."]
#[doc = ""]
#[doc = " Zero if this shifted us forward."]
pub gap: u64,
#[doc = " How far away this credential is from the leading edge of key IDs (before updating the edge)."]
#[doc = ""]
#[doc = " Zero if this didn't change the leading edge."]
pub forward_shift: u64,
}
#[cfg(any(test, feature = "testing"))]
impl<'a> crate::event::snapshot::Fmt for KeyAccepted<'a> {
Expand All @@ -902,6 +908,7 @@ pub mod api {
fmt.field("credential_id", &"[HIDDEN]");
fmt.field("key_id", &self.key_id);
fmt.field("gap", &self.gap);
fmt.field("forward_shift", &self.forward_shift);
fmt.finish()
}
}
Expand Down Expand Up @@ -1618,8 +1625,9 @@ pub mod tracing {
credential_id,
key_id,
gap,
forward_shift,
} = event;
tracing :: event ! (target : "key_accepted" , parent : parent , tracing :: Level :: DEBUG , credential_id = tracing :: field :: debug (credential_id) , key_id = tracing :: field :: debug (key_id) , gap = tracing :: field :: debug (gap));
tracing :: event ! (target : "key_accepted" , parent : parent , tracing :: Level :: DEBUG , credential_id = tracing :: field :: debug (credential_id) , key_id = tracing :: field :: debug (key_id) , gap = tracing :: field :: debug (gap) , forward_shift = tracing :: field :: debug (forward_shift));
}
#[inline]
fn on_replay_definitely_detected(
Expand Down Expand Up @@ -2626,8 +2634,14 @@ pub mod builder {
pub struct KeyAccepted<'a> {
pub credential_id: &'a [u8],
pub key_id: u64,
#[doc = " How far away this credential is from the leading edge of key IDs."]
#[doc = " How far away this credential is from the leading edge of key IDs (after updating the edge)."]
#[doc = ""]
#[doc = " Zero if this shifted us forward."]
pub gap: u64,
#[doc = " How far away this credential is from the leading edge of key IDs (before updating the edge)."]
#[doc = ""]
#[doc = " Zero if this didn't change the leading edge."]
pub forward_shift: u64,
}
impl<'a> IntoEvent<api::KeyAccepted<'a>> for KeyAccepted<'a> {
#[inline]
Expand All @@ -2636,11 +2650,13 @@ pub mod builder {
credential_id,
key_id,
gap,
forward_shift,
} = self;
api::KeyAccepted {
credential_id: credential_id.into_event(),
key_id: key_id.into_event(),
gap: gap.into_event(),
forward_shift: forward_shift.into_event(),
}
}
}
Expand Down
Loading
Loading