pub struct BranchMonitor { /* private fields */ }Implementations§
Source§impl BranchMonitor
impl BranchMonitor
pub fn new(node_id: &str) -> Self
Sourcepub fn with_sink(self, sink: SharedSink) -> Self
pub fn with_sink(self, sink: SharedSink) -> Self
Attach an observation sink (JSON Lines, OTel, database adapter, …).
Sourcepub fn with_service(self, service: impl Into<String>) -> Self
pub fn with_service(self, service: impl Into<String>) -> Self
Identify the service/component this monitor runs in, for the observations it emits.
Sourcepub fn with_service_version(self, version: impl Into<String>) -> Self
pub fn with_service_version(self, version: impl Into<String>) -> Self
Identify the software version generating observations, distinct from the deployment slot. Lets an analyst compare “predictions from build v1” against “observations generated by v1”.
Sourcepub fn with_deployment(self, deployment: impl Into<String>) -> Self
pub fn with_deployment(self, deployment: impl Into<String>) -> Self
Identify the deployment/environment (e.g. prod-us-east-1).
Sourcepub fn with_build_ref(self, build_ref: impl Into<String>) -> Self
pub fn with_build_ref(self, build_ref: impl Into<String>) -> Self
A stable reference to the compiled reliability artifact/build that produced this service, so observations can be traced back to the model that predicted them without embedding the whole artifact.
Sourcepub fn record_failure_observation(&self, observation: ReliabilityObservation)
pub fn record_failure_observation(&self, observation: ReliabilityObservation)
Record an immutable failure observation for offline analysis. Lightweight: does not run statistics, query databases, or call AI.
pub fn with_sla(node_id: &str, sla_tracker: Arc<Mutex<SlaTracker>>) -> Self
pub fn with_chaos(node_id: &str, chaos: Arc<Mutex<ChaosController>>) -> Self
pub fn record_branch(&mut self, outcome: &str, declared_probability: f64)
pub fn record_failure( &mut self, operation_id: &str, error: &dyn Error, declared_probability: Option<f64>, )
Sourcepub fn record_success(
&mut self,
operation_id: &str,
declared_probability: Option<f64>,
)
pub fn record_success( &mut self, operation_id: &str, declared_probability: Option<f64>, )
Record that operation_id completed without failing. Must be
called on the same "{operation_id}.failure" SLA key
[record_failure] uses, with occurred = false, or that key’s
rolling window only ever sees failures (every entry record_failure
ever pushes) and its observed frequency is permanently 1.0 —
which made [record_failure]’s anomaly check fire unconditionally
for any operation that failed at least a handful of times over its
lifetime (sla::MIN_OBSERVATIONS), regardless of its actual overall
failure rate. Generated code calls this from
the operation’s Ok arm whenever it calls record_failure from the
matching Err arm (i.e. whenever onFailureProbabilitySource is
declared and resolves) — see codegen/rust.rs’s Ok(_result) =>
arm.