# pstats

> Monkey patch for Q to send your promises' stats to graphite.

Latest version **0.1.1** (published 2014-09-29) · MIT license · 0 weekly downloads

## Install

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

## 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.1.1 |
| Published | 2014-09-29 |
| First published | 2014-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tim Borodin |
| Maintainers | tim.borodin |
| Keywords | q, promise, promises, stats, graphite |

## Links

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

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-09-29
- 0.1.0 — 2014-09-29

## README

This module applies patches Q library to extend promises with *stats* method. 


```javascript
var StatsD = require('node-statsd').StatsD;
var statsClient = new StatsD({prefix: 'project.'});

require('pstats')(statsClient);

longAsyncOperation()
    .then(anotherLongAsyncOperation)
    .stats('operations.xxx');
```

This will send following stats to graphite:
```
Counters:
    project.operations.xxx.attempted +1
    project.operations.xxx.succeeded +1
    or
    project.operations.xxx.failed +1
Timing:
    project.operations.xxx dt
```

Start time is the moment when your promise chain is being constructed (stats method called).

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