diff --git a/agent/src/common/decapsulate.rs b/agent/src/common/decapsulate.rs index 32ad08c5e13..e3d2aee605d 100644 --- a/agent/src/common/decapsulate.rs +++ b/agent/src/common/decapsulate.rs @@ -110,24 +110,32 @@ impl TunnelTypeBitmap { bitmap } - pub fn from_slice(tunnel_types: &Vec) -> Self { + fn init_from_strings(&mut self, tunnel_types: &Vec) { + for s in tunnel_types { + let tunnel_type = TunnelType::from(s.as_str()); + if tunnel_type == TunnelType::None { + warn!("Unknown tunnel type {}.", s); + continue; + } + self.add(tunnel_type); + } + } + + pub fn from_slices(tunnel_types: &Vec, trim_tunnel_types: &Vec) -> Self { let mut bitmap = TunnelTypeBitmap(0); for tunnel_type in tunnel_types.iter() { bitmap.0 |= 1 << *tunnel_type as u16; } + + bitmap.init_from_strings(trim_tunnel_types); + bitmap } pub fn from_strings(tunnel_types: &Vec) -> Self { let mut bitmap = TunnelTypeBitmap(0); - for s in tunnel_types { - let tunnel_type = TunnelType::from(s.as_str()); - if tunnel_type == TunnelType::None { - warn!("Unknown tunnel type {}.", s); - continue; - } - bitmap.add(tunnel_type); - } + + bitmap.init_from_strings(tunnel_types); bitmap } diff --git a/agent/src/config/config.rs b/agent/src/config/config.rs index 3e595f3c587..b4b6983447b 100644 --- a/agent/src/config/config.rs +++ b/agent/src/config/config.rs @@ -915,6 +915,7 @@ impl Default for EbpfSocketUprobeGolang { } #[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq)] +#[serde(default)] pub struct EbpfSocketUprobeDpdk { pub command: String, pub rx_hooks: Vec, @@ -2482,7 +2483,7 @@ pub struct UserConfig { impl From<&RuntimeConfig> for UserConfig { fn from(rc: &RuntimeConfig) -> Self { - let mut user_config = Self { + Self { global: Global { limits: Limits { max_millicpus: rc.max_millicpus, @@ -3246,9 +3247,7 @@ impl From<&RuntimeConfig> for UserConfig { dev: Dev { feature_flags: rc.yaml_config.feature_flags.clone(), }, - }; - user_config.modify(); - user_config + } } } @@ -3480,20 +3479,6 @@ impl UserConfig { Ok(()) } - fn modify_decap_types(&mut self) { - for tunnel_type in &self.inputs.cbpf.preprocess.tunnel_trim_protocols { - self.inputs - .cbpf - .preprocess - .tunnel_decap_protocols - .push(TunnelType::from(tunnel_type.as_str()) as u8) - } - } - - fn modify(&mut self) { - self.modify_decap_types(); - } - fn set_standalone(&mut self) { self.global.common.enabled = true; self.global.communication.ingester_ip = "127.0.0.1".to_string(); @@ -3507,7 +3492,6 @@ impl UserConfig { self.outputs.socket.data_socket_type = agent::SocketType::File; self.outputs.flow_log.filters.l4_capture_network_types = vec![3]; self.outputs.flow_log.filters.l7_capture_network_types = vec![3]; - self.modify(); } pub fn standalone_default() -> Self { diff --git a/agent/src/config/handler.rs b/agent/src/config/handler.rs index 02e9a7fa1f1..453c96a2aa9 100755 --- a/agent/src/config/handler.rs +++ b/agent/src/config/handler.rs @@ -54,7 +54,6 @@ use super::{ }, ConfigError, KubernetesPollerType, }; -use crate::common::decapsulate::TunnelType; use crate::dispatcher::recv_engine; use crate::flow_generator::protocol_logs::decode_new_rpc_trace_context_with_type; use crate::rpc::Session; @@ -1614,15 +1613,9 @@ impl TryFrom<(Config, UserConfig)> for ModuleConfig { dpdk_source: conf.inputs.cbpf.special_network.dpdk.source, dispatcher_queue: conf.inputs.cbpf.tunning.dispatcher_queue_enabled, l7_log_packet_size: conf.processors.request_log.tunning.payload_truncation, - tunnel_type_bitmap: TunnelTypeBitmap::new( - &conf - .inputs - .cbpf - .preprocess - .tunnel_decap_protocols - .iter() - .map(|x| TunnelType::from(*x as i32)) - .collect(), + tunnel_type_bitmap: TunnelTypeBitmap::from_slices( + &conf.inputs.cbpf.preprocess.tunnel_decap_protocols, + &conf.inputs.cbpf.preprocess.tunnel_trim_protocols, ), tunnel_type_trim_bitmap: TunnelTypeBitmap::from_strings( &conf.inputs.cbpf.preprocess.tunnel_trim_protocols, @@ -4563,6 +4556,8 @@ impl ConfigHandler { restart_agent = !first_run; } + candidate_config.enabled = new_config.enabled; + candidate_config.capture_mode = new_config.capture_mode; if candidate_config.dispatcher != new_config.dispatcher { #[cfg(any(target_os = "linux", target_os = "android"))] { diff --git a/server/agent_config/README-CH.md b/server/agent_config/README-CH.md index de6e03b0a4f..4b59e41a024 100644 --- a/server/agent_config/README-CH.md +++ b/server/agent_config/README-CH.md @@ -3026,15 +3026,15 @@ Upgrade from old version: `max_collect_pps` inputs: cbpf: tunning: - max_capture_pps: 200 + max_capture_pps: 200000 ``` **模式**: | Key | Value | | ---- | ---------------------------- | | Type | int | -| Unit | Kpps | -| Range | [1, 1000000] | +| Unit | pps | +| Range | [1, 10000000] | **详细描述**: diff --git a/server/agent_config/README.md b/server/agent_config/README.md index 550cf9ab564..62ace189710 100644 --- a/server/agent_config/README.md +++ b/server/agent_config/README.md @@ -3100,15 +3100,15 @@ Upgrade from old version: `max_collect_pps` inputs: cbpf: tunning: - max_capture_pps: 200 + max_capture_pps: 200000 ``` **Schema**: | Key | Value | | ---- | ---------------------------- | | Type | int | -| Unit | Kpps | -| Range | [1, 1000000] | +| Unit | pps | +| Range | [1, 10000000] | **Description**: diff --git a/server/agent_config/template.yaml b/server/agent_config/template.yaml index 2a7efdbf062..be2c161aa27 100644 --- a/server/agent_config/template.yaml +++ b/server/agent_config/template.yaml @@ -1935,7 +1935,7 @@ inputs: # en: Max Capture PPS # ch: 最大采集 PPS # unit: pps - # range: [1, 1000000] + # range: [1, 10000000] # enum_options: [] # modification: hot_update # ee_feature: false