pub struct PowCapabilityScorer { /* private fields */ }Expand description
Configurable deterministic scorer for a
PowCapabilityProfile.
The scorer is Copy so it can live in a static
configuration struct without a wrapper. The default
configuration (PowCapabilityScorer::default) is the
recommended starting point — every field is documented
and has a public constant.
Implementations§
Source§impl PowCapabilityScorer
impl PowCapabilityScorer
Sourcepub const fn with_weights(self, weights: ProfileWeights) -> Self
pub const fn with_weights(self, weights: ProfileWeights) -> Self
Replace the scoring weights.
Sourcepub const fn with_min_observations(self, min_observations: u32) -> Self
pub const fn with_min_observations(self, min_observations: u32) -> Self
Replace the minimum-observation floor.
A value of 0 effectively disables sparse-telemetry
fallback (the scorer will return a score for any
non-empty profile). Negative values are clamped to
0 so the public surface stays simple.
Sourcepub const fn with_latency_budget_ms(self, latency_budget_ms: u64) -> Self
pub const fn with_latency_budget_ms(self, latency_budget_ms: u64) -> Self
Replace the latency budget (milliseconds) used to
score the p95 latency term. A value of 0 falls
back to the documented default so the latency term
never silently becomes “always penalised”.
Sourcepub fn with_retry_budget(self, retry_budget: f64) -> Self
pub fn with_retry_budget(self, retry_budget: f64) -> Self
Replace the retry budget used to score the average retries term. A non-positive value falls back to the documented default.
Sourcepub const fn weights(&self) -> ProfileWeights
pub const fn weights(&self) -> ProfileWeights
Current weights.
Sourcepub const fn min_observations(&self) -> u32
pub const fn min_observations(&self) -> u32
Current minimum-observation floor.
Sourcepub const fn latency_budget_ms(&self) -> u64
pub const fn latency_budget_ms(&self) -> u64
Current latency budget in milliseconds.
Sourcepub const fn retry_budget(&self) -> f64
pub const fn retry_budget(&self) -> f64
Current retry budget.
Sourcepub fn score(&self, profile: &PowCapabilityProfile) -> f64
pub fn score(&self, profile: &PowCapabilityProfile) -> f64
Score a PowCapabilityProfile.
Returns SPARSE_FALLBACK_SCORE when the profile has
fewer attempts than
PowCapabilityScorer::min_observations
(the documented “no signal” default). Otherwise the
four scoring terms are blended through the configured
weights and re-normalised so the result is in
[0.0, 1.0] even when the weights do not sum to
1.0.
Sourcepub fn band(&self, profile: &PowCapabilityProfile) -> PowCapabilityBand
pub fn band(&self, profile: &PowCapabilityProfile) -> PowCapabilityBand
Score a profile and return a coarse
PowCapabilityBand.
The band thresholds are fixed and documented
(strong ≥ 0.75, degraded ≥ 0.40, weak
otherwise). Profiles that do not meet the
minimum-observation floor return
PowCapabilityBand::Unknown.
Trait Implementations§
Source§impl Clone for PowCapabilityScorer
impl Clone for PowCapabilityScorer
Source§fn clone(&self) -> PowCapabilityScorer
fn clone(&self) -> PowCapabilityScorer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more