0.2.0 • Published 10 years ago

statsy v0.2.0

Weekly downloads
111
License
MIT
Repository
github
Last release
10 years ago

statsy

A simple statsd client.

Installation

$ npm install statsy

Example

var Client = require('statsy');
var http = require('http');
var stats = new Client;

setInterval(function(){
  stats.incr('requests');
  var end = stats.timer('request');
  http.get('http://yahoo.com', function(err, res){
    // do stuff
    end();
  });
}, 1000);

API

Client(opts)

Initialize a client with the given options:

  • host localhost
  • port 8125
  • prefix optional prefix ('.' is appended)
  • tcp use TCP instead of UDP

Events from the socket are forwarded, however by default errors are simply ignored. When TCP is used reconnection attempts will be made until the connection is re-established.

.gauge(name, val)

Send gauge value.

.meter(name, val)

Send meter value.

.set(name, val)

Send set value.

.count(name, val)

Send count value.

.incr(name, val)

Increment by val or 1.

.decr(name, val)

Decrement by val or 1.

.histogram(name, val)

Send histogram value.

.histogram(name)

Return histogram delta function.

.timer(name, val)

Send timer value.

.timer(name)

Return timer delta function.

License

MIT

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago