This Plug is meant to help collect statistics about the time it takes your application to process HTTP requests. It emits a value for the processing time after every processed HTTP request.
The backend needs to provide a histogram
function that the Plug uses to send the metrics over. This
function's behavior is described in PlugStats.Behaviours.Backend
.
The metric emitted is called "web.request" (configurable) and contains the following tags:
action
- Controller and action name, underscored (e.g. "queue_controller.show")http_method
- HTTP method in lower casehttp_status
- Response status code (200, 404 etc)http_status_class
- Response status class (2xx, 4xx etc)
The package can be installed by adding stats_plug
to your list of dependencies in mix.exs
:
def deps do
[
{:stats_plug, "~> 1.0.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. The docs can be found at https://hexdocs.pm/stats_plug.