#[repr(i32)]pub enum AggregationTemporality {
Unspecified = 0,
Delta = 1,
Cumulative = 2,
}
gen-tonic-messages
and metrics
only.Expand description
AggregationTemporality defines how a metric aggregator reports aggregated values. It describes how those values relate to the time interval over which they are aggregated.
Variants§
Unspecified = 0
UNSPECIFIED is the default AggregationTemporality, it MUST not be used.
Delta = 1
DELTA is an AggregationTemporality for a metric aggregator which reports changes since last report time. Successive metrics contain aggregation of values from continuous and non-overlapping intervals.
The values for a DELTA metric are based only on the time interval associated with one measurement cycle. There is no dependency on previous measurements like is the case for CUMULATIVE metrics.
For example, consider a system measuring the number of requests that it receives and reports the sum of these requests every second as a DELTA metric:
- The system starts receiving at time=t_0.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_0 to t_0+1 with a value of 3.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_0+1 to t_0+2 with a value of 2.
Cumulative = 2
CUMULATIVE is an AggregationTemporality for a metric aggregator which reports changes since a fixed start time. This means that current values of a CUMULATIVE metric depend on all previous measurements since the start time. Because of this, the sender is required to retain this state in some form. If this state is lost or invalidated, the CUMULATIVE metric values MUST be reset and a new fixed start time following the last reported measurement time sent MUST be used.
For example, consider a system measuring the number of requests that it receives and reports the sum of these requests every second as a CUMULATIVE metric:
- The system starts receiving at time=t_0.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_0 to t_0+1 with a value of 3.
- A request is received, the system measures 1 request.
- A request is received, the system measures 1 request.
- The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_0 to t_0+2 with a value of 5.
- The system experiences a fault and loses state.
- The system recovers and resumes receiving at time=t_1.
- A request is received, the system measures 1 request.
- The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_1 to t_0+1 with a value of 1.
Note: Even though, when reporting changes since last report time, using CUMULATIVE is valid, it is not recommended. This may cause problems for systems that do not use start_time to determine when the aggregation value was reset (e.g. Prometheus).
Implementations§
source§impl AggregationTemporality
impl AggregationTemporality
sourcepub fn is_valid(value: i32) -> bool
pub fn is_valid(value: i32) -> bool
Returns true
if value
is a variant of AggregationTemporality
.
sourcepub fn from_i32(value: i32) -> Option<AggregationTemporality>
👎Deprecated: Use the TryFrom<i32> implementation instead
pub fn from_i32(value: i32) -> Option<AggregationTemporality>
Converts an i32
to a AggregationTemporality
, or None
if value
is not a valid variant.
source§impl AggregationTemporality
impl AggregationTemporality
sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
source§impl Clone for AggregationTemporality
impl Clone for AggregationTemporality
source§fn clone(&self) -> AggregationTemporality
fn clone(&self) -> AggregationTemporality
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AggregationTemporality
impl Debug for AggregationTemporality
source§impl Default for AggregationTemporality
impl Default for AggregationTemporality
source§fn default() -> AggregationTemporality
fn default() -> AggregationTemporality
source§impl<'de> Deserialize<'de> for AggregationTemporality
impl<'de> Deserialize<'de> for AggregationTemporality
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 From<AggregationTemporality> for i32
impl From<AggregationTemporality> for i32
source§fn from(value: AggregationTemporality) -> i32
fn from(value: AggregationTemporality) -> i32
source§impl From<Temporality> for AggregationTemporality
impl From<Temporality> for AggregationTemporality
source§fn from(temporality: Temporality) -> Self
fn from(temporality: Temporality) -> Self
source§impl Hash for AggregationTemporality
impl Hash for AggregationTemporality
source§impl Ord for AggregationTemporality
impl Ord for AggregationTemporality
source§fn cmp(&self, other: &AggregationTemporality) -> Ordering
fn cmp(&self, other: &AggregationTemporality) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AggregationTemporality
impl PartialEq for AggregationTemporality
source§impl PartialOrd for AggregationTemporality
impl PartialOrd for AggregationTemporality
source§impl Serialize for AggregationTemporality
impl Serialize for AggregationTemporality
source§impl TryFrom<i32> for AggregationTemporality
impl TryFrom<i32> for AggregationTemporality
source§type Error = UnknownEnumValue
type Error = UnknownEnumValue
source§fn try_from(value: i32) -> Result<AggregationTemporality, UnknownEnumValue>
fn try_from(value: i32) -> Result<AggregationTemporality, UnknownEnumValue>
impl Copy for AggregationTemporality
impl Eq for AggregationTemporality
impl StructuralPartialEq for AggregationTemporality
Auto Trait Implementations§
impl Freeze for AggregationTemporality
impl RefUnwindSafe for AggregationTemporality
impl Send for AggregationTemporality
impl Sync for AggregationTemporality
impl Unpin for AggregationTemporality
impl UnwindSafe for AggregationTemporality
Blanket Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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