pub(super) mod aws;
use crate::trace::{SpanId, TraceId};
use rand::{rngs, Rng};
use std::cell::RefCell;
#[derive(Clone, Debug, Default)]
pub struct IdGenerator {
_private: (),
}
impl crate::trace::IdGenerator for IdGenerator {
fn new_trace_id(&self) -> TraceId {
CURRENT_RNG.with(|rng| TraceId::from(rng.borrow_mut().gen::<[u8; 16]>()))
}
fn new_span_id(&self) -> SpanId {
CURRENT_RNG.with(|rng| SpanId::from(rng.borrow_mut().gen::<[u8; 8]>()))
}
}
thread_local! {
static CURRENT_RNG: RefCell<rngs::ThreadRng> = RefCell::new(rngs::ThreadRng::default());
}