Skip to main content

ScanMetrics

Struct ScanMetrics 

Source
pub struct ScanMetrics {
    pub detections: u32,
    pub redacted: u32,
    pub restored: u32,
    pub blocked: u32,
    pub by_entity_type: BTreeMap<String, u32>,
    pub latency_us: u64,
}
Expand description

A single scanner’s content-free metrics for one run: counts and per-entity- type tallies plus the scanner’s own latency. Every field is a count, a verdict, or an entity-type label — never matched content, a redacted value, or plaintext — so a ScanReport is safe to log or emit wholesale.

The counts are derived by the ScannerStack run loop, not reported by the scanner itself (the Scanner::scan surface stays a pure text -> Verdict): the loop times each scan and diffs the shared Vault’s type-keyed tallies across the call. A transform scanner’s redacted/by_entity_type is the vault-intern delta; a restore scanner’s restored is the vault restore-tally delta; a block scanner’s detections/ blocked come from its Verdict.

Fields§

§detections: u32

Matches or entities this scanner found. For a transform scanner this is the number of distinct values redacted; for a block scanner it is 1 on a hit, 0 otherwise.

§redacted: u32

Distinct values this scanner transformed/replaced (redactions). 0 for a pure block scanner, which never rewrites.

§restored: u32

Sentinels this scanner put back (restore scanners only).

§blocked: u32

How many times this scanner blocked: 1 when it returned a [Block] verdict with valid = false, else 0.

§by_entity_type: BTreeMap<String, u32>

Per-entity-type redaction counts (EMAIL, AWS_ACCESS_KEY…). Keys are type labels, never values, and the map is empty for a block scanner.

§latency_us: u64

Wall-clock time spent in this scanner’s Scanner::scan, in microseconds.

Trait Implementations§

Source§

impl Clone for ScanMetrics

Source§

fn clone(&self) -> ScanMetrics

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScanMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScanMetrics

Source§

fn default() -> ScanMetrics

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ScanMetrics

Source§

fn eq(&self, other: &ScanMetrics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ScanMetrics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V