pub struct ProcessorMount { /* private fields */ }
Expand description
A building block for grouping
Implementations§
Source§impl ProcessorMount
impl ProcessorMount
Sourcepub fn new<T: Into<String>>(name: T) -> ProcessorMount
pub fn new<T: Into<String>>(name: T) -> ProcessorMount
Creates a new instance.
Even though a name is optional having one is the default since this struct is mostly used to group other components.
Sourcepub fn set_name<T: Into<String>>(&mut self, name: T)
pub fn set_name<T: Into<String>>(&mut self, name: T)
Sets the name of this ProcessorMount
Examples found in repository?
examples/demo_run.rs (line 136)
97fn create_bar_metrics() -> (TelemetryTransmitter<BarLabel>, ProcessorMount) {
98 let mut bar_a_panel = Panel::named(BarLabel::A, "bar_a_panel")
99 .counter(Counter::new_with_defaults("bar_a_counter"));
100 bar_a_panel.add_gauge(Gauge::new_with_defaults("bar_a_gauge"));
101 bar_a_panel.add_meter(Meter::new_with_defaults("bar_a_meter"));
102 bar_a_panel.add_histogram(Histogram::new_with_defaults("bar_a_histogram"));
103
104 let mut bar_a_cockpit = Cockpit::without_name();
105 bar_a_cockpit.add_panel(bar_a_panel);
106
107 let mut bar_b_panel = Panel::new(BarLabel::B);
108 bar_b_panel.add_counter(Counter::new_with_defaults("bar_b_counter"));
109 bar_b_panel.add_gauge(Gauge::new_with_defaults("bar_b_gauge"));
110 bar_b_panel.add_meter(Meter::new_with_defaults("bar_b_meter"));
111 bar_b_panel.add_histogram(Histogram::new_with_defaults("bar_b_histogram"));
112
113 let mut bar_b_cockpit = Cockpit::new("bar_b_cockpit");
114 bar_b_cockpit.add_panel(bar_b_panel);
115
116 let mut bar_c_panel = Panel::named(BarLabel::C, "bar_c_panel");
117 bar_c_panel.add_counter(Counter::new_with_defaults("bar_c_counter"));
118 bar_c_panel.add_gauge(Gauge::new_with_defaults("bar_c_gauge"));
119 bar_c_panel.add_meter(Meter::new_with_defaults("bar_c_meter"));
120 bar_c_panel.add_histogram(Histogram::new_with_defaults("bar_c_histogram"));
121
122 let mut bar_c_cockpit = Cockpit::new("bar_c_cockpit");
123 bar_c_cockpit.add_panel(bar_c_panel);
124
125 let (tx, mut processor) = TelemetryProcessor::new_pair_without_name();
126
127 processor.add_cockpit(bar_a_cockpit);
128 processor.add_cockpit(bar_b_cockpit);
129 processor.add_cockpit(bar_c_cockpit);
130
131 let mut group_processor1 = ProcessorMount::default();
132 group_processor1.add_processor(processor);
133
134 let mut group_processor2 = ProcessorMount::default();
135 group_processor2.add_processor(group_processor1);
136 group_processor2.set_name("group_processor_2");
137
138 let polled_counter = PolledCounter::new();
139 let mut polled_instrument =
140 PollingInstrument::new_with_defaults("polled_instrument_2", polled_counter);
141 polled_instrument.set_title("The polled counter 2");
142 polled_instrument.set_description("A counter that is increased when a snapshot is polled");
143
144 group_processor2.add_snapshooter(polled_instrument);
145
146 (tx, group_processor2)
147}
Sourcepub fn set_inactivity_limit(&mut self, limit: Duration)
pub fn set_inactivity_limit(&mut self, limit: Duration)
Sets the maximum amount of time this processor may be inactive until no more snapshots are taken
Sourcepub fn processors(&self) -> Vec<&dyn ProcessesTelemetryMessages>
pub fn processors(&self) -> Vec<&dyn ProcessesTelemetryMessages>
Returns the processors in this ProcessorMount
Sourcepub fn snapshooters(&self) -> Vec<&dyn PutsSnapshot>
pub fn snapshooters(&self) -> Vec<&dyn PutsSnapshot>
Returns the snapshooters of this ProcessorMount
pub fn add_processor_dyn( &mut self, processor: Box<dyn ProcessesTelemetryMessages>, )
pub fn add_snapshooter_dyn(&mut self, snapshooter: Box<dyn PutsSnapshot>)
Trait Implementations§
Source§impl AggregatesProcessors for ProcessorMount
impl AggregatesProcessors for ProcessorMount
Source§fn add_processor<P: ProcessesTelemetryMessages>(&mut self, processor: P)
fn add_processor<P: ProcessesTelemetryMessages>(&mut self, processor: P)
Add a processor.
Source§fn add_snapshooter<S: PutsSnapshot>(&mut self, snapshooter: S)
fn add_snapshooter<S: PutsSnapshot>(&mut self, snapshooter: S)
Add a snapshooter.
fn attached_mount(&mut self, mount: ProcessorMount) -> AttachedMount
Source§impl Default for ProcessorMount
impl Default for ProcessorMount
Source§fn default() -> ProcessorMount
fn default() -> ProcessorMount
Returns the “default value” for a type. Read more
Source§impl Descriptive for ProcessorMount
impl Descriptive for ProcessorMount
Source§impl ProcessesTelemetryMessages for ProcessorMount
impl ProcessesTelemetryMessages for ProcessorMount
Source§fn process(
&mut self,
max: usize,
strategy: ProcessingStrategy,
) -> ProcessingOutcome
fn process( &mut self, max: usize, strategy: ProcessingStrategy, ) -> ProcessingOutcome
Receive and handle pending operations
Source§impl PutsSnapshot for ProcessorMount
impl PutsSnapshot for ProcessorMount
Source§fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
Puts the current snapshot values into the given
Snapshot
thereby
following the guidelines of PutsSnapshot
.Auto Trait Implementations§
impl Freeze for ProcessorMount
impl !RefUnwindSafe for ProcessorMount
impl Send for ProcessorMount
impl !Sync for ProcessorMount
impl Unpin for ProcessorMount
impl !UnwindSafe for ProcessorMount
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
Mutably borrows from an owned value. Read more