Skip to main content

BranchMonitor

Struct BranchMonitor 

Source
pub struct BranchMonitor { /* private fields */ }

Implementations§

Source§

impl BranchMonitor

Source

pub fn new(node_id: &str) -> Self

Source

pub fn with_sink(self, sink: SharedSink) -> Self

Attach an observation sink (JSON Lines, OTel, database adapter, …).

Source

pub fn with_service(self, service: impl Into<String>) -> Self

Identify the service/component this monitor runs in, for the observations it emits.

Source

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”.

Source

pub fn with_deployment(self, deployment: impl Into<String>) -> Self

Identify the deployment/environment (e.g. prod-us-east-1).

Source

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.

Source

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.

Source

pub fn with_sla(node_id: &str, sla_tracker: Arc<Mutex<SlaTracker>>) -> Self

Source

pub fn with_chaos(node_id: &str, chaos: Arc<Mutex<ChaosController>>) -> Self

Source

pub fn record_branch(&mut self, outcome: &str, declared_probability: f64)

Source

pub fn record_failure( &mut self, operation_id: &str, error: &dyn Error, declared_probability: Option<f64>, )

Source

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.

Source

pub fn flush(&self)

Trait Implementations§

Source§

impl Drop for BranchMonitor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<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, 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.