raxx v0.15.10 Raxx.RequestID
Generate a unique identifier for a request.
An invalid id, sent as x-request-id
, will be overwritten if it is invalid.
A valid id is any string between 20 and 200 charachters
The request id is added to the Logger metadata as :request_id
.
To see the request id in your log output, configure your logger backends to include the :request_id
metadata:
To use this middleware just use it in any Raxx.Server module.
use Raxx.RequestID
Link to this section Summary
Functions
Fetch the id of a request or generate new value
Link to this section Functions
Link to this function
ensure_request_id(head)
Fetch the id of a request or generate new value
Examples
iex> request(:GET, "/")
...> |> set_header("x-request-id", "12345678901234567890")
...> |> ensure_request_id()
...> |> elem(0)
"12345678901234567890"