Skip to content

Commit d908fc5

Browse files
yuanchaoakylewanginchina
authored andcommitted
fix: endpoint hash
1 parent e65f8e1 commit d908fc5

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

agent/src/collector/collector.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct StashKey {
137137
dst_ip: IpAddr,
138138
src_gpid: u32,
139139
dst_gpid: u32,
140-
endpoint_hash: u32,
140+
endpoint_hash: u64,
141141
// request-reponse time span
142142
time_span: u32,
143143
biz_type: u8,
@@ -198,7 +198,7 @@ impl StashKey {
198198

199199
const ACL: Code = Code::ACL_GID.union(Code::TUNNEL_IP_ID).union(Code::VTAP_ID);
200200

201-
fn new(tagger: &Tagger, src_ip: IpAddr, dst_ip: Option<IpAddr>, endpoint_hash: u32) -> Self {
201+
fn new(tagger: &Tagger, src_ip: IpAddr, dst_ip: Option<IpAddr>, endpoint_hash: u64) -> Self {
202202
let mut fast_id = 0;
203203
match tagger.code {
204204
// single point
@@ -779,7 +779,7 @@ impl Stash {
779779
}
780780
}
781781

782-
fn fill_single_l7_stats(&mut self, tagger: Tagger, endpoint_hash: u32, app_meter: AppMeter) {
782+
fn fill_single_l7_stats(&mut self, tagger: Tagger, endpoint_hash: u64, app_meter: AppMeter) {
783783
// The l7_protocol of otel data may not be available, so report all otel data metrics.
784784
if tagger.l7_protocol != L7Protocol::Unknown || tagger.signal_source == SignalSource::OTel {
785785
// Only data whose direction is c|s|local|c-p|s-p|c-app|s-app|app has app_meter.
@@ -796,7 +796,7 @@ impl Stash {
796796
}
797797
}
798798

799-
fn fill_edge_l7_stats(&mut self, tagger: Tagger, endpoint_hash: u32, app_meter: AppMeter) {
799+
fn fill_edge_l7_stats(&mut self, tagger: Tagger, endpoint_hash: u64, app_meter: AppMeter) {
800800
// The l7_protocol of otel data may not be available, so report all otel data metrics.
801801
// application metrics (vtap_app_edge_port)
802802
if tagger.l7_protocol != L7Protocol::Unknown || tagger.signal_source == SignalSource::OTel {

agent/src/collector/l7_quadruple_generator.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ pub struct QgCounter {
5959
pub stash_total_capacity: AtomicU64,
6060
}
6161

62-
impl AppMeterWithFlow {}
63-
6462
struct QuadrupleStash {
6563
meters: HashMap<u64, Vec<Box<AppMeterWithFlow>>>,
6664
}
@@ -260,7 +258,7 @@ impl SubQuadGen {
260258
app_meter: &AppMeter,
261259
time_in_second: Duration,
262260
time_span: u32,
263-
endpoint_hash: u32,
261+
endpoint_hash: u64,
264262
is_active_host0: bool,
265263
is_active_host1: bool,
266264
) -> AppMeterWithFlow {
@@ -284,7 +282,7 @@ impl SubQuadGen {
284282
&mut self,
285283
l7_stats: &L7Stats,
286284
app_meter: &AppMeter,
287-
endpoint_hash: u32,
285+
endpoint_hash: u64,
288286
time_in_second: Duration,
289287
possible_host: &mut Option<PossibleHost>,
290288
) {
@@ -638,7 +636,7 @@ impl L7QuadrupleGenerator {
638636
let l7_stats = l7_stats.unwrap();
639637

640638
let endpoint_hash = match &l7_stats.endpoint {
641-
Some(e) => hash_to_u64(e) as u32,
639+
Some(e) => hash_to_u64(e),
642640
None => 0,
643641
};
644642

agent/src/collector/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl FlowMeterWithFlow {
170170
pub struct AppMeterWithFlow {
171171
pub flow: MiniFlow,
172172
pub l7_protocol: L7Protocol,
173-
pub endpoint_hash: u32,
173+
pub endpoint_hash: u64,
174174
pub endpoint: Option<String>,
175175
pub biz_type: u8,
176176
pub is_active_host0: bool,

0 commit comments

Comments
 (0)