fujiapple852 / trippy

A network diagnostic tool
https://trippy.cli.rs
Apache License 2.0
3.22k stars 68 forks source link

Improve error messages #1150

Closed mpenning closed 1 month ago

mpenning commented 2 months ago

Describe the feature you'd like

--min-round-duration and --max-round-duration

Sub-second float values for min and max round duration would be extremely useful. When packet loss is 1% or 2%, it takes a while to send enough packets at 1-second round-trip values. Allowing lower values would substantially increase the speed of detecting the actual packet loss percentage.

If --max-round-duration is set lower than --min-round-duration, --min-round-duration should automatically be set to the requested --max-round-duration value.

fujiapple852 commented 2 months ago

@mpenning both of these settings can be specified in various time units including ms, see example:

https://github.com/fujiapple852/trippy?tab=readme-ov-file#usage-examples

trip example.com -i 250ms -g 50ms

Aside: note the grace period setting exists, which you want wish to tweak as well to fully saturate the line.

Perhaps the Trippy help output could be improved to make this more discoverable?

fujiapple852 commented 2 months ago

Regarding:

If --max-round-duration is set lower than --min-round-duration, --min-round-duration should automatically be set to the requested --max-round-duration value.

The current behaviour is to validate these values and error out if the max is lower than the min, which I think is reasonable behaviour. In general I prefer to avoid any “surprising” behaviour where the tool does something the user did not request.

mpenning commented 1 month ago

@mpenning both of these settings can be specified in various time units including ms, see example:

https://github.com/fujiapple852/trippy?tab=readme-ov-file#usage-examples

trip example.com -i 250ms -g 50ms

Aside: note the grace period setting exists, which you want wish to tweak as well to fully saturate the line.

Perhaps the Trippy help output could be improved to make this more discoverable?

Yes, specifically I filed this bug after trying this:

$ trip -i 0.05 4.2.2.2
Error: invalid character at 1
$

I mistakenly assumed that a sub-second value was not possible... if you could return the same error as this one, it would be more clear...

$ trip -i 2 4.2.2.2
Error: time unit needed, for example 2sec or 2ms
fujiapple852 commented 1 month ago

@mpenning this is improved in #1162, for the above example the error will now be:

$ trip -i 0.05 4.2.2.2
error: invalid value '0.05' for '--min-round-duration <MIN_ROUND_DURATION>': expected time unit (i.e. 100ms, 2s, 1000us)

For more information, try '--help'.

This covers all "duration" parameters, namely: