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

feat display jitter #882

Closed
wants to merge 1 commit into from

Conversation

trkelly23
Copy link
Collaborator

@trkelly23 trkelly23 commented Dec 22, 2023

The branch is currently a WIP to get feedback on Jitter calculations and display.

Know issues:
The display will overflow if all the columns are displayed; though as an interim fix, the Constraint::Min is used.
Jitter columns will only show using tui-custom-columns
Jitter columns display in json & tui mode's only. Json was added for saving test results for comparison to mtr.

Closes #39

@fujiapple852 fujiapple852 marked this pull request as draft December 23, 2023 01:05
src/backend/trace.rs Outdated Show resolved Hide resolved
let last_ms = hop.last_ms().map_or(0f64, |d|d);
let jitter_ms = (last_ms - dur_ms).abs();
let jitter_dur = Duration::from_millis(jitter_ms as u64);
hop.jitter = Some(jitter_dur);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set to be Some unconditionally, I guess we should only set this if hop.last is Some?

src/backend/trace.rs Outdated Show resolved Hide resolved
src/backend/trace.rs Outdated Show resolved Hide resolved
src/backend/trace.rs Outdated Show resolved Hide resolved
@fujiapple852
Copy link
Owner

fujiapple852 commented Dec 28, 2023

@trkelly23 I've added a few minor review comments on the impl but aside from that the logic of all four calculations (jttr, javg, jmax, jinta) looks correct to me. Have you been able to run a side by side comparison with mtr to eyeball the results?

@fujiapple852
Copy link
Owner

Display will overflow if all the columns are displayed.

Yes, I think we're now going to have to solve the general issue of table column sizing when we have a variable number of columns with varying minimum size requirements. The switch here to use Min has a fairly dramatic effect on the table layout and i'm not convinced that is what we want here. What do you think the right solution is here? I'll have a think as well.

Jitter columns will only show using tui-custom-columns

I think this is fine for now. There are lots of other columns I would like to add that would not be shown be default (for example, estimate geographic distance between hops when both GeoIps are known). As we discussed before, in the future we may want to add a dialog for dynamic column selection.

@trkelly23
Copy link
Collaborator Author

@trkelly23 I've added a few minor review comments on the impl but aside from that the logic of all four calculations (jttr, javg, jmax, jinta) looks correct to me. Have you been able to run a side by side comparison with mtr to eyeball the results?

I have run a many side by side tests the best comparison method was to add the jitter fields to trippy JSON output and run both.
image
Above are typical results some values are very close or not. Has this been your experience?
Any suggestions on other tests?

A set of results run 1/1/2024.
1_trip_test.json
2_trip_test.json
2_mtr_test.json
1_mtr_test.json

@trkelly23 trkelly23 force-pushed the feat-display-jitter branch from 0955ae8 to 0d75c2e Compare January 1, 2024 15:48
@trkelly23 trkelly23 force-pushed the feat-display-jitter branch 4 times, most recently from 1bed4bb to f113f8a Compare January 15, 2024 17:05
Merge in of fujiapple852#925 improvement on column display.

feat display jitter

feat display jitter(WIP)

Includes possible test approach using JSON to mimic trace data

feat(tui): improve column width layout logic (WIP)
@trkelly23 trkelly23 force-pushed the feat-display-jitter branch from f113f8a to d026669 Compare January 15, 2024 23:16
jinta,
}
}
//TODO: Create combined struct ImportProbe Vec<ImportProbe> & HopResults.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a good idea. Can we use yaml rather than json as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at the TUN test code I had the same exact thought, make all test input files the same type.
Consider it done!

@@ -52,6 +52,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
tracing-chrome = "0.7.1"
petgraph = "0.6.4"
csv = "1.3.0"
iso8601-timestamp = "0.2.16"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid needing this dep? Can humantime be used instead? Note it could be in [dev-dependancies] as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see input the difference (RTTx - RTTx-1) - I can easily move to this type of model.
Yes, it should only be needed as a [dev-dependancies].

#[test_case("base_line.json", &HopResults::new(2,2,700,300,700,0.0,0.0,400,350.0,400,680.28))]
fn test_probe_file(json_file: &str, expected: &HopResults) {
let mut json = String::new();
let mut dir_json_file = "./tests/data/".to_owned();
Copy link
Owner

@fujiapple852 fujiapple852 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use include_str!() to read these at compile time? See

macro_rules! sim {
($path:expr) => {{
let yaml = include_str!(concat!("../resources/simulation/", $path));
serde_yaml::from_str(yaml)?
}};
}
for an example

@fujiapple852
Copy link
Owner

Superseded by #937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calculate and display Jitter
2 participants