[−][src]Struct metrix::instruments::Panel
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]
pub fn new(label: L) -> Panel<L>
[src]
Create a new Panel
without a name.
pub fn with_name<T: Into<String>>(label: L, name: T) -> Panel<L>
[src]
Create a new Panel
with the given name
pub fn set_counter(&mut self, counter: Counter)
[src]
pub fn counter(&self) -> Option<&Counter>
[src]
pub fn set_gauge(&mut self, gauge: Gauge)
[src]
pub fn gauge(&self) -> Option<&Gauge>
[src]
pub fn set_meter(&mut self, meter: Meter)
[src]
pub fn meter(&self) -> Option<&Meter>
[src]
pub fn set_histogram(&mut self, histogram: Histogram)
[src]
pub fn histogram(&self) -> Option<&Histogram>
[src]
pub fn set_staircase_timer(&mut self, timer: StaircaseTimer)
[src]
use add_instrument
pub fn staircase_timer(&self) -> Option<&StaircaseTimer>
[src]
there will be no replacement
pub fn add_snapshooter<T: PutsSnapshot>(&mut self, snapshooter: T)
[src]
pub fn snapshooters(&self) -> Vec<&dyn PutsSnapshot>
[src]
pub fn add_instrument<I: Instrument>(&mut self, instrument: I)
[src]
pub fn instruments(&self) -> Vec<&dyn Instrument>
[src]
pub fn set_value_scaling(&mut self, value_scaling: ValueScaling)
[src]
pub fn name(&self) -> Option<&str>
[src]
Gets the name of this Panel
pub fn set_name<T: Into<String>>(&mut self, name: T)
[src]
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]
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]
Sets the description
of this Panel
.
A description can be part of a descriptive Snapshot
pub fn set_inactivity_limit(&mut self, limit: Duration)
[src]
Sets the maximum amount of time this panel may be inactive until no more snapshots are taken
Default is no inactivity tracking.
pub fn label(&self) -> &L
[src]
Trait Implementations
impl<L> Updates for Panel<L>
[src]
impl<L> Descriptive for Panel<L>
[src]
impl<L> PutsSnapshot for Panel<L> where
L: Send + 'static,
[src]
L: Send + 'static,
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
Auto Trait Implementations
impl<L> Send for Panel<L> where
L: Send,
L: Send,
impl<L> !Sync for Panel<L>
impl<L> Unpin for Panel<L> where
L: Unpin,
L: Unpin,
impl<L> !UnwindSafe for Panel<L>
impl<L> !RefUnwindSafe for Panel<L>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,