[−][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::*; use metrix::{HandlesObservations, Observation}; #[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::named(SuccessfulRequests, "successful_requests"); panel.add_counter(counter); panel.add_gauge(gauge); panel.add_meter(meter); panel.add_histogram(histogram); let observation = Observation::ObservedOneValue { label: SuccessfulRequests, value: 12.into(), timestamp: Instant::now(), }; panel.handle_observation(&observation);
Methods
impl<L> Panel<L> where
L: Eq + Send + 'static,
[src]
L: Eq + Send + 'static,
pub fn new<F: Into<LabelFilter<L>>>(accept: F) -> Panel<L>
[src]
Create a new Panel
without a name which dispatches observations
with the given label
pub fn named<T: Into<String>, F: Into<LabelFilter<L>>>(
accept: F,
name: T
) -> Panel<L>
[src]
accept: F,
name: T
) -> Panel<L>
Create a new Panel
with the given name which dispatches observations
with the given label
pub fn with_name<T: Into<String>>(label: L, name: T) -> Panel<L>
[src]
use 'named'
Create a new Panel
with the given name which dispatches observations
with the given label
pub fn accept<F: Into<LabelFilter<L>>>(accept: F) -> Self
[src]
Create a new Panel
without a name which dispatches observations
with the given labels
pub fn accept_named<T: Into<String>, F: Into<LabelFilter<L>>>(
accept: F,
name: T
) -> Self
[src]
accept: F,
name: T
) -> Self
Create a new Panel
with the given name which dispatches observations
with the given labels
pub fn accept_all_named<T: Into<String>>(name: T) -> Panel<L>
[src]
Create a new Panel
with the given name which dispatches all
observations
pub fn accept_all() -> Panel<L>
[src]
Create a new Panel
without a name which dispatches all
observations
pub fn set_counter<I: Into<InstrumentAdapter<L, Counter>>>(
&mut self,
counter: I
)
[src]
&mut self,
counter: I
)
use 'add_histogram'
pub fn add_counter<I: Into<InstrumentAdapter<L, Counter>>>(
&mut self,
counter: I
)
[src]
&mut self,
counter: I
)
pub fn counter<I: Into<InstrumentAdapter<L, Counter>>>(self, counter: I) -> Self
[src]
pub fn set_gauge<I: Into<GaugeAdapter<L>>>(&mut self, gauge: I)
[src]
use 'add_gauge'
pub fn gauge<I: Into<GaugeAdapter<L>>>(self, gauge: I) -> Self
[src]
pub fn add_gauge<I: Into<GaugeAdapter<L>>>(&mut self, gauge: I)
[src]
pub fn set_meter<I: Into<InstrumentAdapter<L, Meter>>>(&mut self, meter: I)
[src]
use 'add_meter'
pub fn meter<I: Into<InstrumentAdapter<L, Meter>>>(self, meter: I) -> Self
[src]
pub fn add_meter<I: Into<InstrumentAdapter<L, Meter>>>(&mut self, meter: I)
[src]
pub fn set_histogram<I: Into<InstrumentAdapter<L, Histogram>>>(
&mut self,
histogram: I
)
[src]
&mut self,
histogram: I
)
use 'add_histogram'
pub fn add_histogram<I: Into<InstrumentAdapter<L, Histogram>>>(
&mut self,
histogram: I
)
[src]
&mut self,
histogram: I
)
pub fn histogram<I: Into<InstrumentAdapter<L, Histogram>>>(
self,
histogram: I
) -> Self
[src]
self,
histogram: I
) -> Self
pub fn add_snapshooter<T: PutsSnapshot>(&mut self, snapshooter: T)
[src]
pub fn snapshooter<T: PutsSnapshot>(self, snapshooter: T) -> Self
[src]
pub fn add_instrument<I: Instrument>(&mut self, instrument: I)
[src]
pub fn instrument<T: Instrument>(self, instrument: T) -> Self
[src]
pub fn add_panel(&mut self, panel: Panel<L>)
[src]
pub fn panel(self, panel: Panel<L>) -> Self
[src]
pub fn add_handler<H: HandlesObservations<Label = L>>(&mut self, handler: H)
[src]
pub fn handler<H: HandlesObservations<Label = L>>(self, handler: H) -> Self
[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 inactivity_limit(self, limit: Duration) -> Self
[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 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 accepts_label(&self, label: &L) -> bool
[src]
Trait Implementations
impl<L> Descriptive for Panel<L>
[src]
impl<L> HandlesObservations for Panel<L> where
L: Eq + Send + 'static,
[src]
L: Eq + Send + 'static,
type Label = L
fn handle_observation(
&mut self,
observation: &Observation<Self::Label>
) -> usize
[src]
&mut self,
observation: &Observation<Self::Label>
) -> usize
impl<L> PutsSnapshot for Panel<L> where
L: Eq + Send + 'static,
[src]
L: Eq + Send + 'static,
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
Auto Trait Implementations
impl<L> !RefUnwindSafe for Panel<L>
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>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,