Skip to content

Commit

Permalink
Add total L2 packet length of a session to connection log (#117)
Browse files Browse the repository at this point in the history
* Add total L2 length field to connection log

* Fix test routines to include new fields
  • Loading branch information
jknpark authored Jun 4, 2024
1 parent 9747b03 commit bc6a43d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ file is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and
this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Modified connection log structure to include total L2 frame length of a session.

## [0.17.0] - 2024-05-16

### Added
Expand Down
2 changes: 2 additions & 0 deletions src/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ mod tests {
resp_bytes: 295,
orig_pkts: 397,
resp_pkts: 511,
orig_l2_bytes: 21515,
resp_l2_bytes: 27889,
};
super::send_event(&mut channel.client.send, 9999, conn.clone())
.await
Expand Down
8 changes: 6 additions & 2 deletions src/ingest/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ pub struct Conn {
pub resp_bytes: u64,
pub orig_pkts: u64,
pub resp_pkts: u64,
pub orig_l2_bytes: u64,
pub resp_l2_bytes: u64,
}

impl Display for Conn {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(
f,
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
self.orig_addr,
self.orig_port,
self.resp_addr,
Expand All @@ -42,7 +44,9 @@ impl Display for Conn {
self.orig_bytes,
self.resp_bytes,
self.orig_pkts,
self.resp_pkts
self.resp_pkts,
self.orig_l2_bytes,
self.resp_l2_bytes
)
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ mod tests {
resp_bytes: 295,
orig_pkts: 397,
resp_pkts: 511,
orig_l2_bytes: 21515,
resp_l2_bytes: 27889,
};
let raw_event = bincode::serialize(&conn).unwrap();
let source = bincode::serialize(&"hello").unwrap();
Expand Down Expand Up @@ -706,6 +708,8 @@ mod tests {
resp_bytes: 295,
orig_pkts: 397,
resp_pkts: 511,
orig_l2_bytes: 21515,
resp_l2_bytes: 27889,
};
let raw_event = bincode::serialize(&conn).unwrap();

Expand Down

0 comments on commit bc6a43d

Please sign in to comment.