Skip to content

emb/cowboy_metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

README

In long running cowboy application, sometimes log files are not enough to monitor the behaviour of the application. SNMP is a good starting point to introduce intstrumentation in cowboy. Hence this application.

Cowboy onrequest and onresponse hooks are used for this instrumentation. See Cowboy Hooks for details on the hooks.

SNMP

This application implements the following tables from WWW-MIB defined in RFC-2594:

  • Service Information Table
  • Protocol Summary Table
  • Request In Table
  • Response Out Table

Usage

To use this application, you will need to configure and start erlang snmp agent. Some help here. After that configure your cowboy application to use cowboy_metrics:on_requeqst/1 & cowboy_metrics:on_response/4. Alternatively, you could use cowboy_metrics:start_http/5 instead of cowboy:start_http/4.

Example

Starting a cowboy http server with index of 4.

    %% Snippet
    Dispatch = cowboy_router:compile([{'_', [
                                             {"/", test_handler, []}
                                            ]}
                                     ]),
    {ok, _} = cowboy_metrics:start_http(4, http_handler, 100, [{port, 80}],
                                        [{env, [{dispatch, Dispatch}]}]),
    %% End snippet

Thank you

About

Collect some web server statistics for Cowboy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages