# statsy

> statsd client

Latest version **0.2.0** (published 2014-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install statsy
pnpm add statsy
yarn add statsy
bun add statsy
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2014-04-25 |
| First published | 2014-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 49 |
| Maintainers | tjholowaychuk |
| Keywords | statsd |

## Links

- npm: https://www.npmjs.com/package/statsy
- Repository: https://github.com/segmentio/statsy
- Issues: https://github.com/segmentio/statsy/issues
- npm.io page: https://npm.io/package/statsy

## Dependencies (4)

- [backo](https://npm.io/package/backo.md) ~1.0.1
- [debug](https://npm.io/package/debug.md) ~0.8.0
- [finished](https://npm.io/package/finished.md) ~1.1.2
- [forward-events](https://npm.io/package/forward-events.md) 0.0.1

## Recent versions

- 0.2.0 (latest) — 2014-04-25
- 0.1.1 — 2014-04-25
- 0.1.0 — 2014-04-16
- 0.0.5 — 2014-04-16
- 0.0.4 — 2014-04-16
- 0.0.3 — 2014-04-15
- 0.0.2 — 2014-04-15
- 0.0.1 — 2014-04-15

## README

# statsy

  A simple statsd client.

## Installation

```
$ npm install statsy
```

## Example

```js

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

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