# @playster/statsd-http-plugin

> Statsd Http Plugin ============= #### A statsd plugin to help monitor https calls Every events sent using the api of this plugin will be queued and sent every second

Latest version **0.0.1** (published 2018-07-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install @playster/statsd-http-plugin
pnpm add @playster/statsd-http-plugin
yarn add @playster/statsd-http-plugin
bun add @playster/statsd-http-plugin
```

## 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.0.1 |
| Published | 2018-07-31 |
| First published | 2018-07-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | charles-mathieus-playster, damient-playster, nicolasg-playster |

## Links

- npm: https://www.npmjs.com/package/@playster/statsd-http-plugin
- npm.io page: https://npm.io/package/@playster/statsd-http-plugin

## Dependencies (3)

- [request](https://npm.io/package/request.md) 2.87.0
- [statsd-client](https://npm.io/package/statsd-client.md) ^0.4.2
- [request-promise](https://npm.io/package/request-promise.md) 4.2.2

## Recent versions

- 0.0.1 (latest) — 2018-07-31

## README

Statsd Http Plugin
=============
#### A statsd plugin to help monitor https calls
Every events sent using the api of this plugin will be queued and sent every second

## Installation
```bash
$ npm i -S @playster/statsd-http-plugin
```
or with yarn
```bash
$ yarn add @playster/statsd-http-plugin
```

## Usage
```javascript
// Commonjs
const StatsdHttpPlugin = require('@playster/statsd-http-plugin').default

// ES6 module way
import StatsdHttpPlugin from '@playster/statsd-http-plugin'

const statsd = new StatsdHttpPlugin({
  accumulatorPrefix: 'someprefix', // most likely the http service slug
  host: 'graphite.test.com', // hosts where the stats are sent
  prefix: 'someprefix', // statsd prefix for graphite
  debug: false,
  cacheDns: true,
  interval: 1000
})
```

## API

### success method
Sends a success event
#### example:
```javascript
statsd.success()
```

### error method
Sends a error event
#### example:
```javascript
statsd.error()
```

### timeout method
Sends a timeout event
#### example:
```javascript
statsd.timeout()
```

### timing method
Sends the latency to statsd
#### example:
```javascript
const startTime = Date.now()
const response = await fetch('http://test.com/')
const endTime = Date.now()

statsd.timing(endTime - startTime)
```

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