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

chpr-metrics

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chpr-metrics

Chauffeur Privé's statsd configuration

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
increased by600%
Maintainers
1
Weekly downloads
 
Created
Source

This utility library implements our standard statsd configuration

Requirements

Minimum Node.js version: 4

## Installation

npm install --save chpr-metrics

Configuration

This simple configuration allows you to send metrics to a single statds server

  • METRICS_HOST
  • METRICS_PORT
  • METRICS_PREFIX (prepended to all metrics name)
  • METRICS_SUFFIX (appended to all metrics name)
  • METRICS_CACHE_DNS (set to "true" to activate caching, any other values disables dns caching)

Advanced configuration

If you need to send metrics to several destinations, you can use the METRICS_DESTINATIONS variable, which allows you to specify a list of destinations as a JSON array:

Complete example:

[{
  "METRICS_HOST": "host1.yourstats.com",
  "METRICS_PORT": "1234",
  "METRICS_PREFIX": "prefix1.",
  "METRICS_SUFFIX": ".suffix1"
}, {
  "METRICS_HOST": "your-other-host.com",
  "METRICS_PORT": "44444",
  "METRICS_PREFIX": "anotherPrefix.",
  "METRICS_SUFFIX": ".anotherSuffix"
}]

If you use this in combination with the individual configuration variables listed in the previous sections, it will send metrics to all directions.

Use

'use strict';

const metrics = require('chpr-metrics');

// Timing: sends a timing command with the specified milliseconds
metrics.timing('response_time', 42);

// Increment: Increments a stat by a value (default is 1)
metrics.increment('my_counter');

The exported object is the configured statds client: see https://github.com/sivy/node-statsd

Keywords

FAQs

Package last updated on 06 Dec 2017

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