pub struct ShadowClassifier { /* private fields */ }Expand description
Serves the expensive adapter’s answers, unchanged, and asks the cheap one the same questions to measure agreement. The cheap adapter cannot change or fail a result: its errors are logged, recorded and counted as skipped.
Both adapters are asked concurrently, on the caller’s task, and the call returns when both have: its latency is the slower of the two, not the sum. A cheap call that stalls still holds the shadowed call, so the cheap adapter must enforce its own deadline. When the expensive adapter fails, its error is the call’s; the cheap call is still recorded.
profile is the expensive adapter’s: every
answer returned is its.
Implementations§
Source§impl ShadowClassifier
impl ShadowClassifier
Sourcepub fn new(
cheap: (AdapterId, Arc<dyn Classifier>),
expensive: (AdapterId, Arc<dyn Classifier>),
accounting: Accounting,
) -> Self
pub fn new( cheap: (AdapterId, Arc<dyn Classifier>), expensive: (AdapterId, Arc<dyn Classifier>), accounting: Accounting, ) -> Self
A shadow measuring cheap against expensive.
Sourcepub fn report(&self) -> AgreementReport
pub fn report(&self) -> AgreementReport
The agreement measured so far — ungraded, since live traffic has no ground truth.
Trait Implementations§
Source§impl Classifier for ShadowClassifier
impl Classifier for ShadowClassifier
Source§fn profile(&self) -> ClassifierProfile
fn profile(&self) -> ClassifierProfile
confidence comes from, and
how much state it will carry.