Skip to main content

ActivityMetrics

Struct ActivityMetrics 

Source
pub struct ActivityMetrics {
Show 22 fields pub service_time: Arc<Timer>, pub wait_time: Arc<Timer>, pub response_time: Arc<Timer>, pub tries_histogram: Arc<Histogram>, pub cycles_total: Arc<Counter>, pub skips_total: Arc<Counter>, pub attempt_total: Arc<Counter>, pub attempt_success: OutcomeInstrument, pub attempt_failure: OutcomeInstrument, pub result_total: Arc<Counter>, pub result_success: OutcomeInstrument, pub result_failure: OutcomeInstrument, pub errors_total: Arc<Counter>, pub stanzas_total: Arc<Counter>, pub daemon_cancelled_total: Arc<Counter>, pub daemon_errors_total: Arc<Counter>, pub ops_started: AtomicU64, pub ops_finished: AtomicU64, pub result_elements: Arc<Counter>, pub result_bytes: Arc<Counter>, pub progress_override_ppm: AtomicU64, pub progress_override_elapsed_ms: AtomicU64, /* private fields */
}

Fields§

§service_time: Arc<Timer>§wait_time: Arc<Timer>§response_time: Arc<Timer>§tries_histogram: Arc<Histogram>

Number of tries per op (1 = succeeded first try, 2+ = retried). Distribution shape reveals incremental saturation.

§cycles_total: Arc<Counter>

Every op dispatched (incl. skips) — the rate driver. Distinct from result_total, which excludes skips. SRD-91.

§skips_total: Arc<Counter>§attempt_total: Arc<Counter>

Per-ATTEMPT total — one increment per dispenser.execute, including retries.

§attempt_success: OutcomeInstrument

Per-ATTEMPT outcomes (+ attempt latency when Timed). The count is available in either detail mode — see OutcomeInstrument.

§attempt_failure: OutcomeInstrument§result_total: Arc<Counter>

Per-OP terminal total — executed results only (success + failure; excludes skips). Distinct from cycles_total by the skip count.

§result_success: OutcomeInstrument

Per-OP terminal outcomes (+ op latency when Timed). result_success replaces the former result_success_time timer and the unexported successes_total counter — its count() IS the terminal-success count.

§result_failure: OutcomeInstrument§errors_total: Arc<Counter>

Error-handler-layer tally: one increment per failed attempt at error dispatch (per-attempt, so retries DO count here), keyed by the handler-classified name for the per-type breakdown. The per-op error rate uses result_failure instead, keeping it in [0,1]. SRD-91.

§stanzas_total: Arc<Counter>§daemon_cancelled_total: Arc<Counter>

Daemon ops that exited cleanly via stop-signal cancellation at phase shutdown (the trigger-and-observe happy path). Counts increment on DaemonExit::Cancelled only — natural completions are tracked through result_success / result_failure on the underlying op path. Visibility on this counter lets the operator distinguish “phase exited with N daemons cancelled” from “phase exited with no daemons in flight” without re-reading session.log.

§daemon_errors_total: Arc<Counter>

Daemon ops whose shutdown failed: returned an error during running or shutdown, panicked, or missed the grace window. Each increment is paired with the activity’s stop_flag being set + a stop_reason being recorded.

§ops_started: AtomicU64

Number of ops dispatched to adapters (monotonic).

§ops_finished: AtomicU64

Number of ops returned from adapters (monotonic).

§result_elements: Arc<Counter>§result_bytes: Arc<Counter>§progress_override_ppm: AtomicU64

Derived phase-progress override, in parts-per-million of the completion fraction (0..=1_000_000); u64::MAX = unset. When set, status surfaces render THIS fraction for the phase’s completion bar / percentage instead of the cycles-based cycles_completed / total_extent — load-bearing for phases whose single long op measures its own progress (e.g. a poll: await publishing completion_ratio from system_views.sstable_tasks), where the cycle count pins the bar at 0% for the whole wait. Stored as integer ppm so the producer/consumer handoff stays a lock-free atomic.

§progress_override_elapsed_ms: AtomicU64

Elapsed milliseconds of the producer that published Self::progress_override_ppm (e.g. the poll’s own elapsed), u64::MAX = unset. Carried so displays can derive an ETA on the measured basis — elapsed × (1−f)/f — instead of the cycle accounting, which stands still for a single long measured op.

Implementations§

Source§

impl ActivityMetrics

Source

pub fn new(labels: &Labels) -> Self

Source

pub fn with_sigdigs( labels: &Labels, sigdigs: u8, detail: &MetricDetailConfig, ) -> Self

Construct activity metrics using an explicit HDR significant-digits precision for every histogram and timer below. The runner resolves hdr.sigdigs from the session root via nmbrs_metrics::instruments::histogram::resolve_hdr_sigdigs once per activity and threads it here (SRD 40 §“HDR significant digits — subtree-scoped setting”).

Source

pub fn register_on( self: &Arc<Self>, component: &mut Component, ) -> Result<(), String>

Register every static instrument on component and install a [DynamicCapture] hook for the dynamic surface (per-error-type counters and adapter-specific metrics from registered dispensers).

Called once from Activity::attach_component. After this point:

  • The cadence reporter’s tree walk picks up every static instrument here through component.capture_delta.
  • Per-cycle code continues recording through this struct’s typed Arc fields — same Arc that the registry holds.
Source

pub fn cycles_completed(&self) -> u64

Return the number of cycles completed so far.

Reads from the cycles_total counter atomically. Used by the progress reporter thread to display live throughput.

Source

pub fn set_progress_override(&self, fraction: Option<f64>)

Publish (or clear, with None) the derived phase-progress override. Some(f) is clamped to [0.0, 1.0] and stored in ppm; see the field doc on Self::progress_override_ppm. Clearing also clears the producer-elapsed companion.

Source

pub fn set_progress_override_with_elapsed( &self, fraction: f64, elapsed_secs: f64, )

As Self::set_progress_override, additionally recording the producer’s own elapsed seconds at publish time. Displays derive the measured-basis ETA from the pair: elapsed × (1−f)/f.

Source

pub fn progress_override(&self) -> Option<f64>

The derived phase-progress override as a fraction in [0.0, 1.0], or None when no producer has published one.

Source

pub fn progress_override_elapsed_secs(&self) -> Option<f64>

The producer-elapsed seconds recorded with the override, or None when unset (no producer, or a producer that publishes the fraction only).

Source

pub fn top_error_types(&self, n: usize) -> String

Increment counter for a specific error type. Creates the counter on first occurrence of each error name. The new counter is read by the [DynamicCapture] hook on every capture tick — registration on Component is implicit through the hook, not a per-name register_instrument call. Top-N error types by count, rendered name=count comma-joined — empty string when no typed errors were recorded. Gives failure messages their WHAT (which error families drove the counters) without a metrics query.

Source

pub fn count_error_type(&self, error_name: &str)

Source

pub fn capture(&self, interval: Duration) -> MetricSet

Capture an absolute snapshot (counters at their current value, timer histograms drained as deltas).

Used by the legacy per-activity capture thread. For the component tree scheduler, use [capture_delta] instead.

Source

pub fn set_dispensers(&self, dispensers: Arc<Vec<Arc<dyn OpDispenser>>>)

Register dispensers for adapter-specific metrics capture.

Source

pub fn set_validation_metrics(&self, vms: Arc<Vec<Arc<ValidationMetrics>>>)

Register the per-template validation metrics so the progress thread can read live relevancy aggregates.

Source

pub fn collect_relevancy_live(&self) -> Vec<RelevancyLive>

Snapshot live relevancy aggregates from every registered validation-metrics instance (one per op template that declared relevancy:). Non-destructive — safe to call every frame.

Source

pub fn collect_status_values(&self, patterns: &[String]) -> Vec<String>

Collect every status-line value whose name matches one of patterns. Patterns are glob-style (* for any run of characters, ? for a single character; literal otherwise), matched against the canonical names below. Returns formatted name:value strings ready to concatenate into the inline progress / DONE summary line, in pattern declaration order with duplicates suppressed.

Supported metric families:

  • Relevancy aggregates — one entry per registered relevancy.functions: (e.g. recall, precision, f1). The relevancy cutoff rides on the metric’s k / r labels rather than the family name. Value: total_mean × 100 as a percent.
  • Latency — latency_p50, latency_p99, latency_max, latency_mean, sourced from service_time (the per-op timer, exclusive of wait time). Value: auto-scaled duration via nmbrs_metrics::reporters::summary::format_duration.
Source

pub fn collect_status_primary( &self, patterns: &[String], ) -> Option<(String, f64)>

The PRIMARY key metric as a raw numeric sample: the first status_metrics: pattern’s first match, in the same candidate order Self::collect_status_values uses (relevancy aggregates as percent, then service-time quantiles as milliseconds). Feeds the key-metric row’s gutter cell TREND (SRD-92 R4): the cell shows the metric’s history as a sparkline — the current value’s single placement is the chips text in the row body. None when nothing matches or nothing has been measured yet.

Source

pub fn collect_status_counters(&self) -> Vec<(String, u64)>

Collect status counters from all registered dispensers.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more