diff --git a/src/samplers/disk/mod.rs b/src/samplers/disk/mod.rs index 01dcbb99..0d265b18 100644 --- a/src/samplers/disk/mod.rs +++ b/src/samplers/disk/mod.rs @@ -156,7 +156,11 @@ impl Disk { // attach only if 'blk_start_request' can be found. if let Ok(results) = bpf.get_kprobe_functions("blk_start_request") { if !results.is_empty() { - probe.try_attach_to_bpf(&mut bpf)? + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } } } @@ -167,7 +171,11 @@ impl Disk { bpf.get_kprobe_functions("blk_account_io_completion") { if !results.is_empty() { - probe.try_attach_to_bpf(&mut bpf)? + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } } } @@ -178,11 +186,22 @@ impl Disk { bpf.get_kprobe_functions("blk_account_io_completion") { if results.is_empty() { - probe.try_attach_to_bpf(&mut bpf)? + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } } } - _ => probe.try_attach_to_bpf(&mut bpf)?, + _ => { + // load + attach the kernel probes that are required to the bpf instance. + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } + } } } diff --git a/src/samplers/ext4/mod.rs b/src/samplers/ext4/mod.rs index 5e79fc42..4f23deea 100644 --- a/src/samplers/ext4/mod.rs +++ b/src/samplers/ext4/mod.rs @@ -144,7 +144,11 @@ impl Ext4 { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))); diff --git a/src/samplers/interrupt/mod.rs b/src/samplers/interrupt/mod.rs index 13b9e334..c8f4c328 100644 --- a/src/samplers/interrupt/mod.rs +++ b/src/samplers/interrupt/mod.rs @@ -148,8 +148,13 @@ impl Interrupt { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } + self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))) } } diff --git a/src/samplers/network/mod.rs b/src/samplers/network/mod.rs index f0ebd804..14959efe 100644 --- a/src/samplers/network/mod.rs +++ b/src/samplers/network/mod.rs @@ -150,7 +150,11 @@ impl Network { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))); diff --git a/src/samplers/page_cache/mod.rs b/src/samplers/page_cache/mod.rs index b0021de3..bace8bbe 100644 --- a/src/samplers/page_cache/mod.rs +++ b/src/samplers/page_cache/mod.rs @@ -139,7 +139,11 @@ impl PageCache { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))) diff --git a/src/samplers/scheduler/mod.rs b/src/samplers/scheduler/mod.rs index 16e8a752..57ac44d5 100644 --- a/src/samplers/scheduler/mod.rs +++ b/src/samplers/scheduler/mod.rs @@ -344,7 +344,11 @@ impl Scheduler { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))); diff --git a/src/samplers/tcp/mod.rs b/src/samplers/tcp/mod.rs index 4d057df5..a2cd429d 100644 --- a/src/samplers/tcp/mod.rs +++ b/src/samplers/tcp/mod.rs @@ -154,7 +154,11 @@ impl Tcp { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf }))) diff --git a/src/samplers/xfs/mod.rs b/src/samplers/xfs/mod.rs index d21d0974..1d163d97 100644 --- a/src/samplers/xfs/mod.rs +++ b/src/samplers/xfs/mod.rs @@ -142,7 +142,11 @@ impl Xfs { // load + attach the kernel probes that are required to the bpf instance. for probe in probes { - probe.try_attach_to_bpf(&mut bpf)?; + if self.common.config.fault_tolerant() { + let _ = probe.try_attach_to_bpf(&mut bpf); + } else { + probe.try_attach_to_bpf(&mut bpf)?; + } } self.bpf = Some(Arc::new(Mutex::new(BPF { inner: bpf })));