@kanziw/statsd-client
v0.1.0-rc0
Published
StatsDClient for InfluxDB
Downloads
3
Readme
StatsDClient
StatsDClient for InfluxDB
Inspired by statsd-client & hot-shots
Installation
$ npm install @kanziw/statsd-client
API
Initialization
import StatsDClient from '@kanziw/statsd-client'
const statsDClient = new StatsDClient({ host: 'statsd.example.com', port: 8125 });
Global options:
- prefix: Prefix all stats with this value (default "").
Counting stuff
Counters are supported, both as raw .counter(metric, delta)
and with the shortcuts .increment(metric, [delta=1])
:
statsDClient.counter('measurements.path', 100) // Increment by 100
statsDClient.increment('measurements.path') // Increment by one
Tags
All the methods above support metric level tags as their last argument. Tags is an object of string key/value pairs:
statsDClient.counter('measurements.path', 100, { tagKey: tagValue })
statsDClient.increment('measurements.path', 1, { tagKey: tagValue }) // Should write delta