[][src]Trait cadence::MetricSink

pub trait MetricSink {
    fn emit(&self, metric: &str) -> Result<usize>;

    fn flush(&self) -> Result<()> { ... }
}

Trait for various backends that send Statsd metrics somewhere.

The metric string will be in the canonical format to be sent to a Statsd server. The metric string will not include a trailing newline. Examples of each supported metric type are given below.

Counter

some.counter:123|c

Timer

some.timer:456|ms

Gauge

some.gauge:5|g

Meter

some.meter:8|m

Histogram

some.histogram:4|h

Set

some.set:2|s

See the Statsd spec for more information.

Required methods

fn emit(&self, metric: &str) -> Result<usize>

Send the Statsd metric using this sink and return the number of bytes written or an I/O error.

Loading content...

Provided methods

fn flush(&self) -> Result<()>

Flush any currently buffered metrics to the underlying backend, returning an I/O error if they could not be written for some reason.

Note that not all sinks buffer metrics and so the default implementation of this method does nothing.

Loading content...

Implementors

impl MetricSink for BufferedSpyMetricSink[src]

impl MetricSink for BufferedUdpMetricSink[src]

impl MetricSink for BufferedUnixMetricSink[src]

impl MetricSink for NopMetricSink[src]

impl MetricSink for QueuingMetricSink[src]

impl MetricSink for SpyMetricSink[src]

impl MetricSink for UdpMetricSink[src]

impl MetricSink for UnixMetricSink[src]

Loading content...