Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including statsd-singly with all npm packages installed. Try it out:

var statsdSingly = require("statsd-singly")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

statsd-singly v0.0.1

statsd-singly

A node.js library for communicating with statsd over UDP. Provides mocha unit tests.

Examples

var statsd = require('statsd-singly').StatsD('localhost', 8125);

// Gauges
statsd.gauge({ users: 35 }).send();

// Multiple gauges
statsd.gauge({ users: 35, guests: 48 }).send();

// Any measurement can also specify a sample rate
statsd.gauge({ users: 35 }).sample(0.5).send();

// Timings (in milliseconds)
statsd.timing({ page-load: 74 }).send();

// Incrementing multiple counters
statsd.increment(['logins', 'errors']).send();

// Decrementing a counter
statsd.decrement('logins').send();

// Modifying a counter by more than +1 or -1
statsd.modify({ errors: 5 }).send();

// Modifying multiple counters
statsd.modify({ errors: 5, syntaxErrors: 2 }).send();

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free