Skip to content

Commit

Permalink
Merge pull request #166 from kunai-project/rename-config-field
Browse files Browse the repository at this point in the history
rename: max_eps_io -> max_eps_fs
  • Loading branch information
qjerome authored Jan 15, 2025
2 parents 71bf040 + 309ecef commit 729f4ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions kunai-common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Filter {
pub struct BpfConfig {
pub loader: Loader,
pub filter: Filter,
pub glob_max_eps_io: Option<u64>,
pub task_max_eps_io: Option<u64>,
pub glob_max_eps_fs: Option<u64>,
pub task_max_eps_fs: Option<u64>,
pub send_data_min_len: u64,
}
4 changes: 2 additions & 2 deletions kunai-ebpf/src/probes/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ unsafe fn limit_eps_with_context<C: EbpfContext>(ctx: &C) -> ProbeResult<bool> {

// we convert event/s to event/sampling
let (Some(glob_limit), Some(task_limit)) = (
cfg.glob_max_eps_io.map(|m| m.div(SAMPLES_IN_1S)),
cfg.task_max_eps_io.map(|m| m.div(SAMPLES_IN_1S)),
cfg.glob_max_eps_fs.map(|m| m.div(SAMPLES_IN_1S)),
cfg.task_max_eps_fs.map(|m| m.div(SAMPLES_IN_1S)),
) else {
// if there is no limit we do not throttle
return Ok(false);
Expand Down
2 changes: 1 addition & 1 deletion kunai/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2894,7 +2894,7 @@ impl TryFrom<RunOpt> for Config {

// we want to increase max_buffered_events
if let Some(max_eps_io) = opt.max_eps_io {
conf.max_eps_io = Some(max_eps_io);
conf.max_eps_fs = Some(max_eps_io);
}

// supersedes configuration
Expand Down
8 changes: 4 additions & 4 deletions kunai/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct Scanner {
pub struct Config {
host_uuid: Option<uuid::Uuid>,
pub max_buffered_events: u16,
pub max_eps_io: Option<u64>,
pub max_eps_fs: Option<u64>,
pub workers: Option<usize>,
pub send_data_min_len: Option<u64>,
pub harden: bool,
Expand Down Expand Up @@ -102,7 +102,7 @@ impl Default for Config {
},
max_buffered_events: DEFAULT_MAX_BUFFERED_EVENTS,
// this x2 rule generally works for small values of max_buffered_events
max_eps_io: Some(DEFAULT_MAX_BUFFERED_EVENTS as u64 * 2),
max_eps_fs: Some(DEFAULT_MAX_BUFFERED_EVENTS as u64 * 2),
workers: None,
send_data_min_len: None,
scanner: Scanner {
Expand Down Expand Up @@ -229,8 +229,8 @@ impl TryFrom<&Config> for BpfConfig {
Ok(Self {
loader: Loader::from_own_pid(),
filter: value.try_into()?,
glob_max_eps_io: value.max_eps_io,
task_max_eps_io: value.max_eps_io.map(|m| m.mul(2).div(3)),
glob_max_eps_fs: value.max_eps_fs,
task_max_eps_fs: value.max_eps_fs.map(|m| m.mul(2).div(3)),
send_data_min_len: value.send_data_min_len.unwrap_or(DEFAULT_SEND_DATA_MIN_LEN),
})
}
Expand Down

0 comments on commit 729f4ec

Please sign in to comment.