use std::time::Duration;
use nm::Event;
thread_local! {
static PACKAGES_RECEIVED: Event = Event::builder()
.name("packages_received")
.build();
static PACKAGE_SEND_DURATION_MS: Event = Event::builder()
.name("package_send_duration_ms")
.build();
}
fn main() {
println!("=== NM README Example ===");
PACKAGES_RECEIVED.with(Event::observe_once);
let send_duration = Duration::from_millis(150);
PACKAGE_SEND_DURATION_MS.with(|e| e.observe_millis(send_duration));
PACKAGES_RECEIVED.with(Event::observe_once);
PACKAGES_RECEIVED.with(Event::observe_once);
let another_duration = Duration::from_millis(75);
PACKAGE_SEND_DURATION_MS.with(|e| e.observe_millis(another_duration));
println!("Observed multiple events - check metrics collection");
println!("README example completed successfully!");
}