Enum vector_core::event::metric::MetricValue
source · pub enum MetricValue {
Counter {
value: f64,
},
Gauge {
value: f64,
},
Set {
values: BTreeSet<String>,
},
Distribution {
samples: Vec<Sample>,
statistic: StatisticKind,
},
AggregatedHistogram {
buckets: Vec<Bucket>,
count: u64,
sum: f64,
},
AggregatedSummary {
quantiles: Vec<Quantile>,
count: u64,
sum: f64,
},
Sketch {
sketch: MetricSketch,
},
}
Expand description
Metric value. Container for the actual value of a metric.
Variants§
Counter
A cumulative numerical value that can only increase or be reset to zero.
Gauge
A single numerical value that can arbitrarily go up and down.
Set
A set of (unordered) unique values for a key.
Distribution
A set of observations without any aggregation or sampling.
Fields
statistic: StatisticKind
The type of statistics to derive for this distribution.
AggregatedHistogram
A set of observations which are counted into buckets.
It also contains the total count of all observations and their sum to allow calculating the mean.
Fields
AggregatedSummary
A set of observations which are represented by quantiles.
Each quantile contains the upper value of the quantile (0 <= φ <= 1). It also contains the total count of all observations and their sum to allow calculating the mean.
Fields
Sketch
A data structure that can answer questions about the cumulative distribution of the contained samples in space-efficient way.
Sketches represent the data in a way that queries over it have bounded error guarantees without needing to hold every single sample in memory. They are also, typically, able to be merged with other sketches of the same type such that client-side and server-side aggregation can be accomplished without loss of accuracy in the queries.
Fields
sketch: MetricSketch
Implementations§
source§impl MetricValue
impl MetricValue
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if the value is empty.
Emptiness is dictated by whether or not the value has any samples or measurements present. Consequently, scalar values (counter, gauge) are never considered empty.
sourcepub fn as_name(&self) -> &'static str
pub fn as_name(&self) -> &'static str
Gets the name of this value as a string.
This maps to the name of the enum variant itself.
sourcepub fn distribution_to_agg_histogram(
&self,
buckets: &[f64],
) -> Option<MetricValue>
pub fn distribution_to_agg_histogram( &self, buckets: &[f64], ) -> Option<MetricValue>
Converts a distribution to an aggregated histogram.
Histogram bucket bounds are based on buckets
, where the value is the upper bound of the bucket. Samples will
be thus be ordered in a “less than” fashion: if the given sample is less than or equal to a given bucket’s upper
bound, it will be counted towards that bucket at the given sample rate.
If this value is not a distribution, then None
is returned. Otherwise,
Some(MetricValue::AggregatedHistogram)
is returned.
sourcepub fn distribution_to_sketch(&self) -> Option<MetricValue>
pub fn distribution_to_sketch(&self) -> Option<MetricValue>
Converts a distribution to a sketch.
This conversion specifically use the AgentDDSketch
sketch variant, in the default configuration that matches
the Datadog Agent, parameter-wise.
If this value is not a distribution, then None
is returned. Otherwise, Some(MetricValue::Sketch)
is
returned.
sourcepub fn zero(&mut self)
pub fn zero(&mut self)
Zeroes out all the values contained in this value.
This keeps all the bucket/value vectors for the histogram and summary metric types intact while zeroing the counts. Distribution metrics are emptied of all their values.
sourcepub fn add(&mut self, other: &Self) -> bool
pub fn add(&mut self, other: &Self) -> bool
Adds another value to this one.
If the other value is not the same type, or if they are but their defining characteristics of the value are
different (i.e. aggregated histograms with different bucket layouts), then false
is returned. Otherwise,
true
is returned.
sourcepub fn subtract(&mut self, other: &Self) -> bool
pub fn subtract(&mut self, other: &Self) -> bool
Subtracts another value from this one.
If the other value is not the same type, or if they are but their defining characteristics of the value are
different (i.e. aggregated histograms with different bucket layouts), then false
is returned. Otherwise,
true
is returned.
Trait Implementations§
source§impl AsRef<MetricValue> for Metric
impl AsRef<MetricValue> for Metric
source§fn as_ref(&self) -> &MetricValue
fn as_ref(&self) -> &MetricValue
source§impl ByteSizeOf for MetricValue
impl ByteSizeOf for MetricValue
source§impl Clone for MetricValue
impl Clone for MetricValue
source§fn clone(&self) -> MetricValue
fn clone(&self) -> MetricValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Configurable for MetricValue
impl Configurable for MetricValue
source§fn referenceable_name() -> Option<&'static str>
fn referenceable_name() -> Option<&'static str>
source§fn generate_schema(
schema_gen: &RefCell<SchemaGenerator>,
) -> Result<SchemaObject, GenerateError>
fn generate_schema( schema_gen: &RefCell<SchemaGenerator>, ) -> Result<SchemaObject, GenerateError>
§fn is_optional() -> boolwhere
Self: Sized,
fn is_optional() -> boolwhere
Self: Sized,
§fn validate_metadata(_metadata: &Metadata) -> Result<(), GenerateError>where
Self: Sized,
fn validate_metadata(_metadata: &Metadata) -> Result<(), GenerateError>where
Self: Sized,
§fn as_configurable_ref() -> ConfigurableRefwhere
Self: Sized + 'static,
fn as_configurable_ref() -> ConfigurableRefwhere
Self: Sized + 'static,
source§impl Debug for MetricValue
impl Debug for MetricValue
source§impl<'de> Deserialize<'de> for MetricValue
impl<'de> Deserialize<'de> for MetricValue
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for MetricValue
impl Display for MetricValue
source§impl From<AgentDDSketch> for MetricValue
impl From<AgentDDSketch> for MetricValue
source§fn from(ddsketch: AgentDDSketch) -> Self
fn from(ddsketch: AgentDDSketch) -> Self
source§impl From<MetricValue> for Value
impl From<MetricValue> for Value
source§fn from(value: MetricValue) -> Self
fn from(value: MetricValue) -> Self
source§impl From<MetricValue> for MetricValue
impl From<MetricValue> for MetricValue
source§fn from(value: MetricValue) -> Self
fn from(value: MetricValue) -> Self
source§impl From<Value> for MetricValue
impl From<Value> for MetricValue
source§fn from(value: MetricValue) -> Self
fn from(value: MetricValue) -> Self
source§impl PartialEq for MetricValue
impl PartialEq for MetricValue
source§impl Serialize for MetricValue
impl Serialize for MetricValue
Auto Trait Implementations§
impl Freeze for MetricValue
impl RefUnwindSafe for MetricValue
impl Send for MetricValue
impl Sync for MetricValue
impl Unpin for MetricValue
impl UnwindSafe for MetricValue
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
§fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more