#[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