cowboy 2
Cowboy2 Plugin
Description
The Cowboy2 plugin collects metrics related to requests served by the application.
Applications it depends on
cowboy
version 2.4 and over
Modules
wombat_plugin_cowboy2
Reports
The Cowboy 2 plugin reports hit counts and average response time for pathsth, it also reports hit counts for different HTTP statuses grouped by their type.
For the plugin to work the application has to be prepared with the following changes:
The handler configuration needs to be extended to include the cowboy metrics handler and a metrics callback has to be added:
1 2 3 4 5 6 7 |
|
The cowboy_metrics_h
module in the stream handlers will prepare Cowboy to call
the metrics_callback
function with the metrics related to a request.
The implementation of the do_metrics_callback
is as follows:
1 2 3 4 5 6 |
|
If the cowboy_metrics_h
is missing or there is no metrics callback, you will
see this warning in Wombat:
1 2 |
|
The metrics will appear on the GUI soon after the plugin has been started and the application started serving requests.
Elixir Configuration
Add metrics_callback
and stream_handlers
to the cowboy2 application start function, and define the do_metric_callback
function as below:
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 |
|