Socket
Book a DemoInstallSign in
Socket

@flowio/metrics

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flowio/metrics

Flow Library for sending app metrics to Hosted Graphite

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
6
Created
Source

@flowio/metrics

Module to send metrics to Hosted Graphite from Flow NodeJS applications. Built in support for automated metrics sent at a defined interval.

Usage

import FlowMetrics from '@flowio/metrics';

const flowMetrics = new FlowMetrics({
  serverHost: 'carbon.hostedgraphite.com',      // host of graphite server
  serverPort: 2003,                             // port of graphite server
  hgApiKey: 'super-secret-key',                 // hosted graphite api-key
  environment: 'production',                    // environment (production | development | test)
  appName: 'app-name',                          // application name
  disableAuto: true,                            // disable autmoatic system metrics (optional)
  collectionInterval: 10000,                    // interval for automatic metrics in ms (optional, default 10000)
});

If you do not pass disableAuto: true the module will automatically send metrics after a delay of collectionInterval milliseconds (default: 10000);

All metrics are expanded into the graphite standard of dot delimited metric names, including the Hosted Graphite API key, for example:

hg-api-key.environment.application-name.hostname.os.memory

default auto metrics are:

{
  os: {
    memory: {
      total: 12340000,
      free: 10240000
    },
    cpu: {
      cpu: 40;
      user: 20;
      nice: 0;
      sys: 20;
      idle: 60;
      irq: 0
    }
    disk: {
      available: 30000000;
      free: 25000000;
      total: 40000000;
    }
  }
}

Custom metrics can be sent using:

flowMetrics.sendMetrics({
  metrics: { ... },
  timestamp: Date.now(),    // optional
  callback: () => {}      // callback method
})

Keywords

flow

FAQs

Package last updated on 09 Mar 2020

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