I’m looking for a library that allows me to make a request to a url and measure the url latency, review the status response, headers, SSL status, etc?
Is there anything like that currently available?
I’m looking for a library that allows me to make a request to a url and measure the url latency, review the status response, headers, SSL status, etc?
Is there anything like that currently available?
You can probably use httpoison for the requests and Elixir:Time for the latency.
To view response, headers, etc, HTTPoison will let you do that. As far as measuring response times for a request, you could measure that with os:timestamp()
or Elixir.Time
.
I’d rather use monotonic time if the code runs on a vm to avoid skews. And keep the measurements (request, parsing, etc) in the process dictionary (if needed).
But replace :os.timestamp()
with :erlang.monotonic_time()
.
Good point
There is also a monotonic_time()
function in elixir System.monotonic_time()
.
And what cool is that in the documentation for the System module there is an example of why you should use monotonic time instead of an os:timestamp.
@amacgregor have a look at https://github.com/scoutapp/elixir_plug_server_timing
Unfortunately, I’m not trying to instrument my current app but using elixir to run test against other domains.