Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphite-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphite-client

Node.js client for Graphite

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

graphite-client

Node.js client for Graphite

##Install

$ npm install graphite-client

Usage

###Create instance

var Graphite = require('graphite-client');

var graphite = new Graphite(serverHost, 2003, 'UTF-8', 3000, function() {
  log.info("Graphite server connection timeout");
});

The client tries to reconnect on connection timeout

###Listen fot the underline socket events

graphite.on('end', function() {
  log.info('Graphite client disconnected');
});

graphite.on('error', function(error) {
  log.info('Graphite connection failure. ' + error);
});

###Connect to the graphite server

graphite.connect(function() { //'connect' listener
  log.info('Connected to Graphite server');
});

###Write to the server

var metrics = {
  'pre1' : {
    'pre2' : {
      'key1' : 'value1',
      'key2' : 'value2',
    },
  },
  'key3' : 'value3'
};
    
graphite.write(metrics, Date.now(), function(err) {
  log.warn("Failed to write metrics to metrics server. err: " + err)
});

Assuming the current time is Jul 13 2015 00:00:00 UTC (1436745600 in sec Unix Epoch Time) The folliwng data will be send to the server

pre1.pre2.key1 value1 1436745600
pre1.pre2.key2 value2 1436745600
key3 value3 1436745600

Keywords

FAQs

Package last updated on 14 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc