[−][src]Struct metrics::Sink
Handle for sending metric samples.
Methods
impl Sink
[src]
pub fn scoped<'a, S: AsScoped<'a> + ?Sized>(&self, scope: &'a S) -> Sink
[src]
Creates a scoped clone of this Sink
.
Scoping controls the resulting metric name for any metrics sent by this Sink
. For
example, you might have a metric called messages_sent
.
With scoping, you could have independent versions of the same metric. This is useful for having the same "base" metric name but with broken down values.
Going further with the above example, if you had a server, and listened on multiple
addresses, maybe you would have a scoped Sink
per listener, and could end up with
metrics that look like this:
listener.a.messages_sent
listener.b.messages_sent
listener.c.messages_sent
- etc
Scopes are also inherited. If you create a scoped Sink
from another Sink
which is
already scoped, the scopes will be merged together using a .
as the string separator.
This makes it easy to nest scopes. Cloning a scoped Sink
, though, will inherit the
same scope as the original.
pub fn now(&self) -> u64
[src]
Gets the current time, in nanoseconds, from the internal high-speed clock.
pub fn record_count<N: Into<MetricName>>(&mut self, name: N, value: u64)
[src]
Records a value for a counter identified by the given name.
pub fn record_gauge<N: Into<MetricName>>(&mut self, name: N, value: i64)
[src]
Records the value for a gauge identified by the given name.
pub fn record_timing<N: Into<MetricName>, V: Delta>(
&mut self,
name: N,
start: V,
end: V
)
[src]
&mut self,
name: N,
start: V,
end: V
)
Records the value for a timing histogram identified by the given name.
Both the start and end times must be supplied, but any values that implement Delta
can
be used which allows for raw values from quanta::Clock
to be used, or measurements from
[Instant::now
].
pub fn record_value<N: Into<MetricName>>(&mut self, name: N, value: u64)
[src]
Records the value for a value histogram identified by the given name.
pub fn counter<N: Into<MetricName>>(&mut self, name: N) -> Counter
[src]
Creates a handle to the given counter.
This handle can be embedded into an existing type and used to directly update the underlying counter. It is merely a proxy, so multiple handles to the same counter can be held and used.
pub fn gauge<N: Into<MetricName>>(&mut self, name: N) -> Gauge
[src]
Creates a handle to the given gauge.
This handle can be embedded into an existing type and used to directly update the underlying gauge. It is merely a proxy, so multiple handles to the same gauge can be held and used.
pub fn histogram<N: Into<MetricName>>(&mut self, name: N) -> Histogram
[src]
Creates a handle to the given histogram.
This handle can be embedded into an existing type and used to directly update the underlying histogram. It is merely a proxy, so multiple handles to the same histogram can be held and used.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self