Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions agent/src/common/decapsulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,32 @@ impl TunnelTypeBitmap {
bitmap
}

pub fn from_slice(tunnel_types: &Vec<usize>) -> Self {
fn init_from_strings(&mut self, tunnel_types: &Vec<String>) {
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<u8>, trim_tunnel_types: &Vec<String>) -> 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<String>) -> 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
}
Expand Down
22 changes: 3 additions & 19 deletions agent/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -3246,9 +3247,7 @@ impl From<&RuntimeConfig> for UserConfig {
dev: Dev {
feature_flags: rc.yaml_config.feature_flags.clone(),
},
};
user_config.modify();
user_config
}
}
}

Expand Down Expand Up @@ -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();
Expand All @@ -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 {
Expand Down
15 changes: 5 additions & 10 deletions agent/src/config/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"))]
{
Expand Down
6 changes: 3 additions & 3 deletions server/agent_config/README-CH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] |

**详细描述**:

Expand Down
6 changes: 3 additions & 3 deletions server/agent_config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:

Expand Down
2 changes: 1 addition & 1 deletion server/agent_config/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down