# graphite

> A node.js client for graphite.

Latest version **0.1.5** (published 2022-07-14) · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2022-07-14 |
| First published | 2011-10-31 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/graphite) |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 105 |
| Author | Felix Geisendörfer |
| Maintainers | felixge, serphentas |

## Links

- npm: https://www.npmjs.com/package/graphite
- Repository: https://github.com/felixge/node-graphite
- Issues: https://github.com/felixge/node-graphite/issues
- npm.io page: https://npm.io/package/graphite

## Recent versions

- 0.1.5 (latest) — 2022-07-14
- 0.1.4 — 2018-11-29
- 0.1.3 — 2018-10-26
- 0.1.2 — 2018-03-09
- 0.1.1 — 2018-01-15
- 0.1.0 — 2018-01-15
- 0.0.7 — 2016-09-12
- 0.0.6 — 2011-11-22
- 0.0.5 — 2011-11-18
- 0.0.4 — 2011-11-18
- 0.0.3 — 2011-11-04
- 0.0.2 — 2011-10-31
- 0.0.1 — 2011-10-31

## README

# graphite

[![Node.js CI](https://github.com/felixge/node-graphite/actions/workflows/node.js.yml/badge.svg)](https://github.com/felixge/node-graphite/actions/workflows/node.js.yml)

A node.js client for graphite.

## Install

```
npm install graphite
```

## Usage

You first have to define the Graphite client:

```js
var graphite = require('graphite');
var client = graphite.createClient('plaintext://graphite.example.org:2003/');
```

You can send metrics without a timestamp. The current Unix epoch will then be used in place:

```js
var metrics = {foo: 23};
client.write(metrics, function(err) {
  // if err is null, your data was sent to graphite!
});
```

If you wish to set your own timestamp, you must use `Date.now()` (millisecond precision) as parameter and not `Math.floor(Date.now() / 1000)` (second precision), otherwise your metrics will probably get ignored by Graphite:

```js
var metrics = {foo: 23};
var timestamp = Date.now();
client.write(metrics, timestamp, function(err) {
  // if err is null, your data was sent to graphite!
});
```

In Graphite [1.1.1 (21.12.17)](http://graphite.readthedocs.io/en/latest/releases/1_1_1.html), [tagging](http://graphite.readthedocs.io/en/latest/tags.html) becomes available. You can send tagged metrics as follows:

```js
var metrics = {foo: 23};
var tags = {'name': 'foo.bar', 'some.fancy.tag': 'somefancyvalue'};
client.writeTagged(metrics, tags, function(err) {
  // if err is null, your data was sent to graphite!
});
```

## Todo

* More docs

## License

Licensed under the MIT license.

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