Struct slottle::ThrottleLog[][src]

pub struct ThrottleLog { /* fields omitted */ }

Collect operation log of a Throttle.

User can access this log by ThrottleBuilder::interval() API by Interval.

ThrottleLog will drop oldest log records automatically when it reach it size limit.

Implementations

impl ThrottleLog[src]

pub fn size(&self) -> usize[src]

Get maximum log size.

This value would never change.

pub fn failure_count(&self) -> usize[src]

Get how many failures exists in log.

Example

(Left is new, right is old, F = Failure, S = Successful)

  • FFFFF: 5
  • FFSFF: 4
  • SFFFF: 4
  • FSSSS: 1

pub fn failure_count_cont(&self) -> usize[src]

Get how many failures from newest log entry continuously.

Example

(Left is new, right is old, F = Failure, S = Successful)

  • FFFFF: 5
  • FFSFF: 2
  • SFFFF: 0
  • FSSSS: 1

pub fn failure_rate(&self) -> Option<f64>[src]

Get failure rate in whole log.

Example

(Left is new, right is old, F = Failure, S = Successful)

  • FFFFF: 1.0
  • FFSFF: 0.8
  • SFFFF: 0.8
  • FSSSS: 0.2

This function use size as denominator. Return None if size == 0.

pub fn duration(&self) -> Option<Duration>[src]

Get duration between first and last log record.

Return None if don’t have at least 2 log records.

Trait Implementations

impl Clone for ThrottleLog[src]

impl Debug for ThrottleLog[src]

impl Eq for ThrottleLog[src]

impl Hash for ThrottleLog[src]

impl PartialEq<ThrottleLog> for ThrottleLog[src]

impl StructuralEq for ThrottleLog[src]

impl StructuralPartialEq for ThrottleLog[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.