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

Detecting connectivity Issues to the destination #38

Closed
atibdialpad opened this issue Oct 15, 2020 · 3 comments
Closed

Detecting connectivity Issues to the destination #38

atibdialpad opened this issue Oct 15, 2020 · 3 comments

Comments

@atibdialpad
Copy link

I have a networking solution which probes the destination with http, mtr, ping etc and collect metrics. Often I see when MTR, Ping return 100% packet loss, httpstat report a very large value of latency. Is it possible to put a time out in the code (preferably configurable) ?

@reorx
Copy link
Owner

reorx commented Oct 15, 2020

It is possible to use curl's timout option -m, --max-time after the URL parameter, like this:

❯ httpstat http://web.localhost:20443/wait -m 2
> curl -w <output-format> -D <tempfile> -o <tempfile> -s -S -m 2 http://web.localhost:20443/wait
curl error: curl: (28) Operation timed out after 2000 milliseconds with 0 bytes received

but curl returns non-zero code when timeout, thus httpstat cannot show the stat result. Is it helpful to your situation?

@atibdialpad
Copy link
Author

awesome. Yeah that helps.

@reorx
Copy link
Owner

reorx commented Oct 15, 2020

Glad to know it helps, and in case you need, I just released a new version to add the metrics only output ability. If you add environment variable HTTPSTAT_METRICS_ONLY=true for httpstat, it will only output json format metrics for easier parsing:

❯ HTTPSTAT_METRICS_ONLY=true httpstat https://reorx.com
{
  "time_namelookup": 520,
  "time_connect": 528,
  "time_appconnect": 1311,
  "time_pretransfer": 1311,
  "time_redirect": 0,
  "time_starttransfer": 1419,
  "time_total": 1419,
  "speed_download": 2901.0,
  "speed_upload": 0.0,
  "remote_ip": "172.104.82.25",
  "remote_port": "443",
  "local_ip": "192.168.50.125",
  "local_port": "63096",
  "range_dns": 520,
  "range_connection": 8,
  "range_ssl": 783,
  "range_server": 108,
  "range_transfer": 0
}

@reorx reorx closed this as completed Oct 15, 2020
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

No branches or pull requests

2 participants