Skip to main content

DynamicCapture

Trait DynamicCapture 

Source
pub trait DynamicCapture: Send + Sync {
    // Required method
    fn capture_into(&self, out: &mut MetricSet, now: Instant, drain: bool);
}
Expand description

Hook for components that own a dynamically-extending set of instruments — e.g. per-error-type counters allocated lazily.

The registry-side Vec<RegisteredInstrument> is the canonical store for instruments known at init. Anything that needs to register more instruments after register_on has run installs a DynamicCapture via Component::set_dynamic_capture; the component’s capture path invokes it after walking the registry so the dynamic samples ride the same cadence pipeline.

Required Methods§

Source

fn capture_into(&self, out: &mut MetricSet, now: Instant, drain: bool)

Append the dynamic instruments’ current samples into out. drain mirrors the registry walk: true for the cadence reporter’s per-tick path (drain histograms, etc.); false for the non-mutating “current” path.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§