Skip to content

Commit 930a889

Browse files
committed
fix: incorrect l7 metrics
1 parent 81af270 commit 930a889

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

agent/src/common/l7_protocol_info.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,14 @@ where
397397
if !cur_info.on_blacklist && cur_info.msg_type == LogMessageType::Request {
398398
timeout_counter.in_cache[index] += 1;
399399
}
400-
let prev_info = rtt_cache.put(key, cur_info).unwrap();
401-
if !prev_info.on_blacklist {
402-
Some(L7PerfStats::from(&prev_info))
400+
let stats = if !prev_info.on_blacklist {
401+
Some(L7PerfStats::from(&cur_info))
403402
} else {
404403
None
405-
}
404+
};
405+
let _ = rtt_cache.put(key, cur_info);
406+
407+
stats
406408
}
407409
} else {
408410
if !prev_info.on_blacklist

agent/src/common/l7_protocol_log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ impl LogCache {
352352
pub fn is_request_of(&self, other: &Self) -> bool {
353353
self.msg_type == LogMessageType::Request
354354
&& other.msg_type == LogMessageType::Response
355-
&& self.time < other.time
355+
&& self.time <= other.time
356356
}
357357

358358
pub fn is_response_of(&self, other: &Self) -> bool {
359359
self.msg_type == LogMessageType::Response
360360
&& other.msg_type == LogMessageType::Request
361-
&& self.time > other.time
361+
&& self.time >= other.time
362362
}
363363
}
364364

0 commit comments

Comments
 (0)