New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

statsdc

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statsdc

A tiny statsd client that supports timing, counters and gauges

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

statsdc

A tiny statsd client that supports timing, counters and gauges.

Installation

NPM
npm install statsdc
GitHub
npm install https://github.com/martinrue/statsdc/tarball/master

Usage

var stats = require('statsdc');

stats.init({ host: 'localhost', port: 8125 }, function(err) {
  // set timer to 100ms
  stats.ms('some-timer', 100);

  // set timer to 500ms, sampling one in ten events
  stats.ms('some-timer', 500, 0.1);

  // set gauge to 11
  stats.g('some-gauge', 11);

  // increment counter by 1
  stats.c('some-counter', 1);

  // decrement counter by 10
  stats.c('some-counter', -10);
});

Config

The following config options are supported:

{
  // required: hostname of statsd server
  host: 'localhost',
  // required: statsd server port
  port: 8125,
  // optional: prefix to attach to all metrics
  prefix: 'my-app',
  // optional: show stats on console
  debug: true
}

Notes

If host is set to a hostname rather than an IP address, a single DNS lookup is performed and cached during init.

If prefix is set, it'll be attached to all outgoing metrics. E.g. with { ... , prefix: 'my-app' }, a call to stats.c('some-counter', 1); will add 1 to the counter named my-app.some-counter.

If you need to shut down the client, stats.close() will gracefully unbind the UDP socket.

Metrics are submitted to statsd on every respective call via UDP. A single UDP socket is created during init and reused.

License

MIT

Keywords

statsd

FAQs

Package last updated on 12 Sep 2015

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