JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3464
  • Score
    100M100P100Q143885F

A node.js client for graphite.

Package Exports

  • graphite
  • graphite/lib/CarbonClient

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

graphite

Build Status

A node.js client for graphite.

Install

npm install graphite

Usage

You first have to define the Graphite client:

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:

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:

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), tagging becomes available. You can send tagged metrics as follows:

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.