Skip to content

Commit fa3ac8f

Browse files
Fix proc scan hook warning and HTTP endpoint borrow
1 parent 775863b commit fa3ac8f

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

agent/src/flow_generator/protocol_logs/http.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,16 +1256,17 @@ impl HttpLog {
12561256
if !config.http_endpoint_disabled && info.path.len() > 0 {
12571257
// Priority use of info.endpoint, because info.endpoint may be set by the wasm plugin
12581258
let _endpoint_already_set = matches!(info.endpoint.as_ref(), Some(p) if !p.is_empty());
1259-
let path_ref = match info.endpoint.as_ref() {
1260-
Some(p) if !p.is_empty() => p.as_str(),
1261-
_ => info.path.as_str(),
1259+
let path_owned = if let Some(p) = info.endpoint.as_ref().filter(|p| !p.is_empty()) {
1260+
p.clone()
1261+
} else {
1262+
info.path.clone()
12621263
};
12631264
// Priority chain: WASM/biz_field > AI Agent detection > http_endpoint Trie
12641265
#[cfg(feature = "enterprise")]
12651266
let ai_agent_matched = if !_endpoint_already_set {
12661267
if let Some(matched_path) = match_ai_agent_endpoint(
12671268
&config.ai_agent_endpoints,
1268-
path_ref,
1269+
path_owned.as_str(),
12691270
param.process_id,
12701271
std::time::Duration::from_micros(param.time),
12711272
) {
@@ -1282,7 +1283,6 @@ impl HttpLog {
12821283
#[cfg(not(feature = "enterprise"))]
12831284
let ai_agent_matched = false;
12841285
if !ai_agent_matched {
1285-
let path_owned = path_ref.to_string();
12861286
info.endpoint = Some(handle_endpoint(config, &path_owned));
12871287
}
12881288
}

agent/src/platform/platform_synchronizer/proc_scan_hook.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use super::ProcessData;
1818

19-
pub fn proc_scan_hook(proc_root: &str, _process_datas: &mut Vec<ProcessData>) {
19+
pub fn proc_scan_hook(_proc_root: &str, _process_datas: &mut Vec<ProcessData>) {
2020
// Enterprise: clean dead AI Agent PIDs and mark alive ones with biz_type
2121
#[cfg(feature = "enterprise")]
2222
{
@@ -25,7 +25,8 @@ pub fn proc_scan_hook(proc_root: &str, _process_datas: &mut Vec<ProcessData>) {
2525
if let Some(registry) = enterprise_utils::ai_agent::global_registry() {
2626
// Use a full /proc scan for cleanup to avoid filtering out short-lived processes
2727
// that are not yet eligible for os_proc_socket_min_lifetime.
28-
let alive_pids: Vec<u32> = match procfs::process::all_processes_with_root(proc_root) {
28+
let alive_pids: Vec<u32> =
29+
match procfs::process::all_processes_with_root(_proc_root) {
2930
Ok(procs) => procs
3031
.into_iter()
3132
.filter_map(|p| p.ok())

0 commit comments

Comments
 (0)