Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add total L2 packet length of a session to connection log #117

Merged
merged 2 commits into from
Jun 4, 2024
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
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
Loading