pub struct AuthMetrics { /* private fields */ }Expand description
Authentication metrics for observability
Implementations§
Source§impl AuthMetrics
impl AuthMetrics
Sourcepub fn new() -> AuthMetrics
pub fn new() -> AuthMetrics
Create new auth metrics
Sourcepub fn record_attempt(&self)
pub fn record_attempt(&self)
Record an authentication attempt
Sourcepub fn record_success(&self)
pub fn record_success(&self)
Record a successful authentication
Sourcepub fn record_failure(&self, error_code: &AuthErrorCode)
pub fn record_failure(&self, error_code: &AuthErrorCode)
Record a failed authentication
Sourcepub fn record_jwks_fetch(&self, latency: Duration, success: bool)
pub fn record_jwks_fetch(&self, latency: Duration, success: bool)
Record JWKS fetch with latency
Sourcepub fn record_verification_latency(&self, latency: Duration)
pub fn record_verification_latency(&self, latency: Duration)
Record token verification latency
Sourcepub fn total_attempts(&self) -> u64
pub fn total_attempts(&self) -> u64
Get total attempts
Sourcepub fn success_count(&self) -> u64
pub fn success_count(&self) -> u64
Get success count
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get success rate (0.0 - 1.0)
Sourcepub fn failure_counts(&self) -> HashMap<String, u64>
pub fn failure_counts(&self) -> HashMap<String, u64>
Get failure counts by error code
Sourcepub fn jwks_fetch_count(&self) -> u64
pub fn jwks_fetch_count(&self) -> u64
Get JWKS fetch count
Sourcepub fn jwks_fetch_latency_us(&self) -> u64
pub fn jwks_fetch_latency_us(&self) -> u64
Get JWKS fetch latency in microseconds
Sourcepub fn jwks_fetch_failures(&self) -> u64
pub fn jwks_fetch_failures(&self) -> u64
Get number of JWKS fetch failures
Sourcepub fn verification_latency_us(&self) -> u64
pub fn verification_latency_us(&self) -> u64
Get verification latency in microseconds
Sourcepub fn snapshot(&self) -> AuthMetricsSnapshot
pub fn snapshot(&self) -> AuthMetricsSnapshot
Get metrics as a serializable snapshot
Trait Implementations§
Source§impl Debug for AuthMetrics
impl Debug for AuthMetrics
Source§impl Default for AuthMetrics
impl Default for AuthMetrics
Source§fn default() -> AuthMetrics
fn default() -> AuthMetrics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AuthMetrics
impl RefUnwindSafe for AuthMetrics
impl Send for AuthMetrics
impl Sync for AuthMetrics
impl Unpin for AuthMetrics
impl UnsafeUnpin for AuthMetrics
impl UnwindSafe for AuthMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more