#[derive(Clone, Debug, PartialEq, Hash)]
pub enum InstrumentKind {
ValueRecorder,
ValueObserver,
Counter,
UpDownCounter,
SumObserver,
UpDownSumObserver,
}
impl InstrumentKind {
pub fn synchronous(&self) -> bool {
matches!(
self,
InstrumentKind::Counter | InstrumentKind::UpDownCounter | InstrumentKind::ValueRecorder
)
}
pub fn asynchronous(&self) -> bool {
!self.synchronous()
}
pub fn adding(&self) -> bool {
matches!(
self,
InstrumentKind::Counter
| InstrumentKind::UpDownCounter
| InstrumentKind::SumObserver
| InstrumentKind::UpDownSumObserver
)
}
pub fn grouping(&self) -> bool {
!self.adding()
}
pub fn monotonic(&self) -> bool {
matches!(self, InstrumentKind::Counter | InstrumentKind::SumObserver)
}
pub fn precomputed_sum(&self) -> bool {
self.adding() && self.asynchronous()
}
}