oc-statsd
OpenComponents plugin for interacting with StatsD inside OC components.
Requirements:
- Node version: min: 6
- OC registry
- StatsD server
Install
npm i oc-statsd --save
Registry setup
More info about integrating OC plugins: here
...const registry = oc; registry; ... registrystartcallback;
Using it inside components
Example for a components' server.js:
moduleexports { const before = ; const stats = contextplugins; ;};
API
Api for plugin setup:
parameter | type | mandatory | description |
---|---|---|---|
debug | boolean |
no | Debug mode |
host | string |
yes | The statsd host |
port | number |
no | Default 8152, the statsd port |
prefix | string |
yes | The statsd prefix |
Api for plugin usage
The plugin name is declared when initialising a plugin. Following assumes statsd
is the designated name.
context.plugins.statsd(namespace)
Gets instance of statsd client in the supplied namespace.
Contributing
Yes please. Open an issue first.
License
MIT