Enum sentry_core::metrics::MetricValue

source ·
pub enum MetricValue {
    Counter(CounterValue),
    Distribution(DistributionValue),
    Set(SetValue),
    Gauge(GaugeValue),
}
Expand description

The value of a Metric, indicating its type.

Variants§

§

Counter(CounterValue)

Counts instances of an event.

Counters can be incremented and decremented. The default operation is to increment a counter by 1, although increments by larger values and even floating point values are possible.

§Example

use sentry::metrics::{Metric, MetricValue};

Metric::build("my.counter", MetricValue::Counter(1.0)).send();
§

Distribution(DistributionValue)

Builds a statistical distribution over values reported.

Based on individual reported values, distributions allow to query the maximum, minimum, or average of the reported values, as well as statistical quantiles. With an increasing number of values in the distribution, its accuracy becomes approximate.

§Example

use sentry::metrics::{Metric, MetricValue};

Metric::build("my.distribution", MetricValue::Distribution(42.0)).send();
§

Set(SetValue)

Counts the number of unique reported values.

Sets allow sending arbitrary discrete values, including strings, and store the deduplicated count. With an increasing number of unique values in the set, its accuracy becomes approximate. It is not possible to query individual values from a set.

§Example

To create a set value, use MetricValue::set_from_str or MetricValue::set_from_display. These functions convert the provided argument into a unique hash value, which is then used as the set value.

use sentry::metrics::{Metric, MetricValue};

Metric::build("my.set", MetricValue::set_from_str("foo")).send();
§

Gauge(GaugeValue)

Stores absolute snapshots of values.

In addition to plain counters, gauges store a snapshot of the maximum, minimum and sum of all values, as well as the last reported value. Note that the “last” component of this aggregation is not commutative. Which value is preserved as last value is implementation-defined.

§Example

use sentry::metrics::{Metric, MetricValue};

Metric::build("my.gauge", MetricValue::Gauge(42.0)).send();

Implementations§

source§

impl MetricValue

source

pub fn set_from_str(string: &str) -> Self

Returns a set value representing the given string.

source

pub fn set_from_display(display: impl Display) -> Self

Returns a set value representing the given argument.

Trait Implementations§

source§

impl Clone for MetricValue

source§

fn clone(&self) -> MetricValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MetricValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for MetricValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for MetricValue

source§

fn eq(&self, other: &MetricValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for MetricValue

source§

impl StructuralPartialEq for MetricValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V