Struct metrix::instruments::Panel [−][src]
pub struct Panel<L> { /* fields omitted */ }
The panel shows recorded observations with the same label in different representations.
Let's say you want to monitor the successful requests of a specific endpoint of your REST API. You would then create a panel for this and might want to add a counter and a meter and a histogram to track latencies.
Example
use std::time::Instant; use metrix::instruments::*; #[derive(Clone, PartialEq, Eq)] struct SuccessfulRequests; let counter = Counter::new_with_defaults("count"); let gauge = Gauge::new_with_defaults("last_latency"); let meter = Meter::new_with_defaults("per_second"); let histogram = Histogram::new_with_defaults("latencies"); assert_eq!(0, counter.get()); assert_eq!(None, gauge.get()); let mut panel = Panel::with_name(SuccessfulRequests, "succesful_requests"); panel.set_counter(counter); panel.set_gauge(gauge); panel.set_meter(meter); panel.set_histogram(histogram); let update = Update::ObservationWithValue(12, Instant::now()); panel.update(&update); assert_eq!(Some(1), panel.counter().map(|c| c.get())); assert_eq!(Some(12), panel.gauge().and_then(|g| g.get()));
Methods
impl<L> Panel<L>
[src]
impl<L> Panel<L>
pub fn new(label: L) -> Panel<L>
[src]
pub fn new(label: L) -> Panel<L>
Create a new Panel
without a name.
pub fn with_name<T: Into<String>>(label: L, name: T) -> Panel<L>
[src]
pub fn with_name<T: Into<String>>(label: L, name: T) -> Panel<L>
Create a new Panel
with the given name
pub fn set_counter(&mut self, counter: Counter)
[src]
pub fn set_counter(&mut self, counter: Counter)
pub fn counter(&self) -> Option<&Counter>
[src]
pub fn counter(&self) -> Option<&Counter>
pub fn set_gauge(&mut self, gauge: Gauge)
[src]
pub fn set_gauge(&mut self, gauge: Gauge)
pub fn gauge(&self) -> Option<&Gauge>
[src]
pub fn gauge(&self) -> Option<&Gauge>
pub fn set_meter(&mut self, meter: Meter)
[src]
pub fn set_meter(&mut self, meter: Meter)
pub fn meter(&self) -> Option<&Meter>
[src]
pub fn meter(&self) -> Option<&Meter>
pub fn set_histogram(&mut self, histogram: Histogram)
[src]
pub fn set_histogram(&mut self, histogram: Histogram)
pub fn histogram(&self) -> Option<&Histogram>
[src]
pub fn histogram(&self) -> Option<&Histogram>
pub fn set_staircase_timer(&mut self, timer: StaircaseTimer)
[src]
pub fn set_staircase_timer(&mut self, timer: StaircaseTimer)
: use add_instrument
pub fn staircase_timer(&self) -> Option<&StaircaseTimer>
[src]
pub fn staircase_timer(&self) -> Option<&StaircaseTimer>
: there will be no replacement
pub fn add_snapshooter<T: PutsSnapshot>(&mut self, snapshooter: T)
[src]
pub fn add_snapshooter<T: PutsSnapshot>(&mut self, snapshooter: T)
pub fn snapshooters(&self) -> Vec<&PutsSnapshot>
[src]
pub fn snapshooters(&self) -> Vec<&PutsSnapshot>
pub fn add_instrument<I: Instrument>(&mut self, instrument: I)
[src]
pub fn add_instrument<I: Instrument>(&mut self, instrument: I)
pub fn instruments(&self) -> Vec<&Instrument>
[src]
pub fn instruments(&self) -> Vec<&Instrument>
pub fn set_value_scaling(&mut self, value_scaling: ValueScaling)
[src]
pub fn set_value_scaling(&mut self, value_scaling: ValueScaling)
pub fn name(&self) -> Option<&str>
[src]
pub fn name(&self) -> Option<&str>
Gets the name of this Panel
pub fn set_name<T: Into<String>>(&mut self, name: T)
[src]
pub fn set_name<T: Into<String>>(&mut self, name: T)
Set the name if this Panel
.
The name is a path segment within a Snapshot
pub fn set_title<T: Into<String>>(&mut self, title: T)
[src]
pub fn set_title<T: Into<String>>(&mut self, title: T)
Sets the title
of this Panel
.
A title can be part of a descriptive Snapshot
pub fn set_description<T: Into<String>>(&mut self, description: T)
[src]
pub fn set_description<T: Into<String>>(&mut self, description: T)
Sets the description
of this Panel
.
A description can be part of a descriptive Snapshot
pub fn label(&self) -> &L
[src]
pub fn label(&self) -> &L
Trait Implementations
impl<L> PutsSnapshot for Panel<L> where
L: Send + 'static,
[src]
impl<L> PutsSnapshot for Panel<L> where
L: Send + 'static,
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
Puts the current snapshot values into the given Snapshot
thereby following the guidelines of PutsSnapshot
. Read more
impl<L> Updates for Panel<L>
[src]
impl<L> Updates for Panel<L>
fn update(&mut self, with: &Update)
[src]
fn update(&mut self, with: &Update)
Update the internal state according to the given Update
. Read more
impl<L> Descriptive for Panel<L>
[src]
impl<L> Descriptive for Panel<L>