Latency simulator is a tool that allows you to simulate latency in a distributed environment. It combines the capabilities of elixir to analyze the behavior of an application in different latency scenarios.
At first, you need to download and compile the dependencies:
mix deps.get
mix deps.compile
From elixir interactive shell
iex -S mix
From dockerfile
docker run --rm -it -p 8080:8080 bancolombia/latency-simulator:latest
Now, this tool expose an endpoint that allows you to simulate latency, with time in milliseconds as a parameter.
curl http://localhost:8080/wait/100 # It'll wait 100 milliseconds
curl http://localhost:8080/wait/3000 # It'll wait 3 seconds
If you want to contribute to this project, enable hooks and run tests before commit.
./enable-hook.sh
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/latency_simulator.