StatsD HTTP client with REST interface for using in browsers.
$ npm install statsd-http-client
All initialization parameters are optional.
Parameters (specified as an options hash):
scheme
: The scheme of addressdefault: http
address
: The address to send stats todefault: ''
. Example: mysite.com. Address has higher priority than host:port.host
: The host to send stats todefault: 127.0.0.1
port
: The port to send stats todefault: 9876
prefix
: What to prefix each stat name withdefault: ''
suffix
: What to suffix each stat name withdefault: ''
useDebounce
: Use debounce for gather batches?default: true
debounceTime
: Debounce time in msdefault: 1000
token
: JWT token secretdefault: none
import { Config, StatsD } from 'statsd-http-client';
const config: Config = {...};
const client = new StatsD(config);
// Increment: Increments a stat by a value (default is 1). Negative numbers converts to positive.
client.increment('name', 3);
// Decrement: Decrement a stat by a value (default is -1). Positive numbers converts to negative.
client.decrement('name', -2);
// Gauge: Gauge a stat by a specified amount (default is 1). Negative numbers converts to positive.
client.gauge('name', 5);
// Shift: Shift a stat by a specified amount (default is -1). Positive numbers converts to negative.
client.shift('name', 4);
// Timing: sends a timing command with the specified milliseconds. Negative numbers converts to positive.
client.timing('name', 500);
// Set: Counts unique occurrences of a stat (alias of unique) (default is 1).
client.set('name', 20);