# strong-statsd

> statsd wrapper for strong-agent backends

Latest version **2.0.7** (published 2016-05-06) · Artistic-2.0 license · 0 weekly downloads

## Install

```sh
npm install strong-statsd
pnpm add strong-statsd
yarn add strong-statsd
bun add strong-statsd
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2016-05-06 |
| First published | 2014-11-15 |
| Weekly downloads | 0 |
| License | Artistic-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | engineering@strongloop.com |
| Maintainers | bajtos, chandadharap, ibmcloud-admin, kraman, octet, rfeng, ritch, rmg, strongloop |

## Links

- npm: https://www.npmjs.com/package/strong-statsd
- Repository: https://github.com/strongloop/strong-statsd
- Homepage: https://github.com/strongloop/strong-statsd#readme
- Issues: https://github.com/strongloop/strong-statsd/issues
- npm.io page: https://npm.io/package/strong-statsd

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^0.9.0
- [debug](https://npm.io/package/debug.md) ^2.0.0
- [statsd-udpkv-backend](https://npm.io/package/statsd-udpkv-backend.md) ^0.2.1

## Recent versions

- 2.0.7 (latest) — 2016-05-06
- 2.0.6 — 2016-05-04
- 2.0.5 — 2016-04-11
- 2.0.4 — 2015-10-05
- 2.0.3 — 2015-09-16
- 2.0.2 — 2015-02-13
- 2.0.1 — 2015-01-13
- 2.0.0 — 2014-12-15
- 1.1.1 — 2014-12-05
- 1.1.0 — 2014-12-01
- 1.0.0 — 2014-11-15

## README

# strong-statsd

Control a statsd child process.

Uses strongloop-forks/strong-fork-statsd, a fork of etsy/statsd with support
for being controlled by a parent process.

## Usage

### Statsd = require('strong-statsd')

Constructor.

### statsd = Statsd(options)

Options:

- debug: cause statsd to log debug messages
- scope: prefix to add before all metric names (default is `""`, but also,
  if the `statsd:` backend URL is used, it can provide a scope that will
  override this option)
- expandScope: function to call on scope before using it as a prefix
- flushInterval: accumulated metrics will be processed and emitted at this
  interval, in seconds (default is 15)

### statsd.backend(url)

Specify one or more backends.

Backend URL formats:

- `statsd://[<host>][:<port>]`: publish metrics to a statsd receiver. The host
  defaults to `"localhost"`, and the port defaults to `8125`.

- `log:[<file>]`: log metrics to FILE, which may be `-` to indicate stdout (FILE
  defaults to `-`). Format is `ISOTIMESTAMP METRIC=VALUE (TYPE)`, where TYPE is
  one of count, gauge, or ms (a timer interval in milliseconds).

- `debug:[?pretty[=<true|false>]]`: json dump to stdout for testing and
  debugging backends. Pretty output is formatted as multi-line with color,
  otherwise it's single line.

- `graphite://[<host>][:<port>]`: forward to
  [graphite](http://graphite.readthedocs.org/en/latest/), host defaults to
  `"localhost"`, port defaults to `2003`

- `syslog:[?[application=<application>][&priority=<priority>]`: write to
  local system log using `syslog(3)`. The application defaults to `"statsd"`,
  and priority defaults to `"LOG_INFO"`, but can be set to any of `"LOG_DEBUG"`,
  `"LOG_INFO"`, `"LOG_NOTICE"`, `"LOG_WARNING"`, or `"LOG_CRIT"`.

- `splunk://[<host>]:<port>`: write using a UDP key value protocol to splunk,
  host defaults to localhost, and port is mandatory, since the protocol has no
  assigned port.

Throws on error in URL format, returns self on success.

### statsd.start(callback)

Starts statsd child process, callback indicates when it is started, and the
statsd port is known.

### statsd.port

The port that the statsd server is listening on.

### statsd.url

A `statsd:` URL that contains the PORT and (unexpanded) scope that should be
published to. The publish is usually done by `.send()`, but this URL may
be useful for display or debug purposes.

### statsd.send(name, value)

Send statsd metric with name and value. Metrics are discarded until statsd
is started.

### statsd.stop(callback)

Stop the statsd child, callback indicates it has exited.

Stopping is optional, the child will self-exit when the parent process exits.

---
_Source: https://npm.io/package/strong-statsd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
