in src/samplers/network/mod.rs [39:64]
fn new(common: Common) -> Result<Self, anyhow::Error> {
let fault_tolerant = common.config.general().fault_tolerant();
let statistics = common.config().samplers().network().statistics();
#[allow(unused_mut)]
let mut sampler = Self {
bpf: None,
bpf_last: Arc::new(Mutex::new(Instant::now())),
common,
proc_net_dev: None,
statistics,
};
if let Err(e) = sampler.initialize_bpf() {
error!("failed to initialize bpf: {}", e);
if !fault_tolerant {
return Err(e);
}
}
if sampler.sampler_config().enabled() {
sampler.register();
}
Ok(sampler)
}