ot-hapi-statsd

Hapi.js stats plugin

Usage no npm install needed!

<script type="module">
  import otHapiStatsd from 'https://cdn.skypack.dev/ot-hapi-statsd';
</script>

README

Hapi Statsd (Plugin)

Hapi.js Plugin for statsd.

This will track your - Count: incoming Request All - Count: incoming Request by path - Timing: response for all paths - Timing: response by path - Count: total response - Count: response by status code - Count: response by url - Count: response by url and status code

STATSD

- For Ex' [GET] /users/all -> Response [200]
- onRequest
    - Count: increment `request.in.users.all.counter'
    - Count: increment `request.in.Total.counter`
- onPreResponse
    - Count increment `response.out.Total.counter`
    - Count increment `response.out.Total.200.counter`
    - Count increment `response.out.users.all.counter`
    - Count increment `response.out.users.all.200.counter`
    - Timer `request.Total.timer`
    - Timer `request.users.all.timer`

Build Status

Quick tour

//SERVER:

server.register([
    register: require('hapi-statsd'),
    options: {
        host: 'statsd.localhost', // your statsd host
        prefix: 'node-app.development.local.', // Prefix
        port: 8125, //must be a number default 8125
        debug: true //could be true/false
        removePath: {
          number: 1, // MUST BE INTEGER
          regex: '/\[[0-9]+\]/' //when to remove part of the path when empty it will on all the routes
        }
    }
])...

Github

Check the GitHub issues.

LICENSE

LICENSE.