use crate::{
metrics::{InstrumentProvider, Meter, MeterProvider},
KeyValue,
};
use std::sync::Arc;
use super::instruments::SyncInstrument;
#[derive(Debug, Default)]
pub(crate) struct NoopMeterProvider {
_private: (),
}
impl NoopMeterProvider {
pub(crate) fn new() -> Self {
NoopMeterProvider { _private: () }
}
}
impl MeterProvider for NoopMeterProvider {
fn meter_with_scope(&self, _scope: crate::InstrumentationScope) -> Meter {
Meter::new(Arc::new(NoopMeter::new()))
}
}
#[derive(Debug, Default)]
pub(crate) struct NoopMeter {
_private: (),
}
impl NoopMeter {
pub(crate) fn new() -> Self {
NoopMeter { _private: () }
}
}
impl InstrumentProvider for NoopMeter {}
#[derive(Debug, Default)]
pub(crate) struct NoopSyncInstrument {
_private: (),
}
impl NoopSyncInstrument {
pub(crate) fn new() -> Self {
NoopSyncInstrument { _private: () }
}
}
impl<T> SyncInstrument<T> for NoopSyncInstrument {
fn measure(&self, _value: T, _attributes: &[KeyValue]) {
}
}