use opentelemetry::Context;
use opentelemetry::KeyValue;
#[derive(Debug, Default, Clone, Copy)]
pub struct NopLongHistogram;
impl NopLongHistogram {
#[inline]
pub fn new() -> Self {
Self
}
#[inline]
pub fn record(&self, _value: i64) {
}
#[inline]
pub fn record_with_attributes(&self, _value: i64, _attributes: &[KeyValue]) {
}
#[inline]
pub fn record_with_context(&self, _value: i64, _attributes: &[KeyValue], _context: &Context) {
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_nop_long_histogram_default() {
let histogram = NopLongHistogram;
histogram.record(100);
}
#[test]
fn test_nop_long_histogram_new() {
let histogram = NopLongHistogram::new();
histogram.record(100);
}
#[test]
fn test_nop_long_histogram_record_with_attributes() {
let histogram = NopLongHistogram::new();
let attributes = [KeyValue::new("key", "value")];
histogram.record_with_attributes(100, &attributes);
}
#[test]
fn test_nop_long_histogram_record_with_context() {
let histogram = NopLongHistogram::new();
let attributes = [KeyValue::new("key", "value")];
let context = Context::current();
histogram.record_with_context(100, &attributes, &context);
}
}