🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

statsy

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statsy

statsd client

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

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

Keywords

statsd

FAQs

Package last updated on 25 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts