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: OutcomeInstrumentPer-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: OutcomeInstrumentPer-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: AtomicU64Number of ops dispatched to adapters (monotonic).
ops_finished: AtomicU64Number of ops returned from adapters (monotonic).
result_elements: Arc<Counter>§result_bytes: Arc<Counter>§progress_override_ppm: AtomicU64Derived 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: AtomicU64Elapsed 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
impl ActivityMetrics
pub fn new(labels: &Labels) -> Self
Sourcepub fn with_sigdigs(
labels: &Labels,
sigdigs: u8,
detail: &MetricDetailConfig,
) -> Self
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”).
Sourcepub fn register_on(
self: &Arc<Self>,
component: &mut Component,
) -> Result<(), String>
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
Arcfields — sameArcthat the registry holds.
Sourcepub fn cycles_completed(&self) -> u64
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.
Sourcepub fn set_progress_override(&self, fraction: Option<f64>)
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.
Sourcepub fn set_progress_override_with_elapsed(
&self,
fraction: f64,
elapsed_secs: f64,
)
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.
Sourcepub fn progress_override(&self) -> Option<f64>
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.
Sourcepub fn progress_override_elapsed_secs(&self) -> Option<f64>
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).
Sourcepub fn top_error_types(&self, n: usize) -> String
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.
pub fn count_error_type(&self, error_name: &str)
Sourcepub fn capture(&self, interval: Duration) -> MetricSet
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.
Sourcepub fn set_dispensers(&self, dispensers: Arc<Vec<Arc<dyn OpDispenser>>>)
pub fn set_dispensers(&self, dispensers: Arc<Vec<Arc<dyn OpDispenser>>>)
Register dispensers for adapter-specific metrics capture.
Sourcepub fn set_validation_metrics(&self, vms: Arc<Vec<Arc<ValidationMetrics>>>)
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.
Sourcepub fn collect_relevancy_live(&self) -> Vec<RelevancyLive>
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.
Sourcepub fn collect_status_values(&self, patterns: &[String]) -> Vec<String>
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’sk/rlabels rather than the family name. Value:total_mean × 100as a percent. - Latency —
latency_p50,latency_p99,latency_max,latency_mean, sourced fromservice_time(the per-op timer, exclusive of wait time). Value: auto-scaled duration vianmbrs_metrics::reporters::summary::format_duration.
Sourcepub fn collect_status_primary(
&self,
patterns: &[String],
) -> Option<(String, f64)>
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.
Sourcepub fn collect_status_counters(&self) -> Vec<(String, u64)>
pub fn collect_status_counters(&self) -> Vec<(String, u64)>
Collect status counters from all registered dispensers.
Auto Trait Implementations§
impl !Freeze for ActivityMetrics
impl Forget for ActivityMetrics
impl Move for ActivityMetrics
impl RefUnwindSafe for ActivityMetricswhere
Atomic<usize>: RefUnwindSafe,
Mutex<Histogram<u64>>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
OnceLock<Arc<LiveWindowHistogram>>: RefUnwindSafe,
Mutex<HashMap<String, Arc<Counter>>>: RefUnwindSafe,
Mutex<Option<Arc<Vec<Arc<dyn OpDispenser>>>>>: RefUnwindSafe,
Mutex<Option<Arc<Vec<Arc<ValidationMetrics>>>>>: RefUnwindSafe,
impl Send for ActivityMetrics
impl Sync for ActivityMetrics
impl Unpin for ActivityMetrics
impl UnsafeUnpin for ActivityMetricswhere
*const ArcInner<Timer> is !null: UnsafeUnpin,
PhantomData<ArcInner<Timer>>: UnsafeUnpin,
*const ArcInner<Histogram> is !null: UnsafeUnpin,
PhantomData<ArcInner<Histogram>>: UnsafeUnpin,
*const ArcInner<Counter> is !null: UnsafeUnpin,
PhantomData<ArcInner<Counter>>: UnsafeUnpin,
Align8<u64>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, Arc<Counter>)>: UnsafeUnpin,
*const ArcInner<Vec<(String, String)>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<(String, String)>>>: UnsafeUnpin,
*const ArcInner<Vec<Arc<dyn OpDispenser>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<Arc<dyn OpDispenser>>>>: UnsafeUnpin,
*const ArcInner<Vec<Arc<ValidationMetrics>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<Arc<ValidationMetrics>>>>: UnsafeUnpin,
impl UnwindSafe for ActivityMetricswhere
Arc<Timer>: UnwindSafe,
Arc<Histogram>: UnwindSafe,
Arc<Counter>: UnwindSafe,
Align8<u64>: UnwindSafe,
Mutex<HashMap<String, Arc<Counter>>>: UnwindSafe,
Arc<Vec<(String, String)>>: UnwindSafe,
Mutex<Option<Arc<Vec<Arc<dyn OpDispenser>>>>>: UnwindSafe,
Mutex<Option<Arc<Vec<Arc<ValidationMetrics>>>>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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