1.0.0 • Published 5 years ago

frichti-metrics v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

This module exposes a singleton containing a fully configured statsd client to emit simple metrics when your app executes.

Configuration is done with environment variables.

The goal is to have a very simple way to emit metrics from the code, like this :

const metrics = require('frichti-metrics')

metrics.increment('hello.metric.world')

On your development, you don't have anything to do. Without configuration, emiting a metric doesn't do anything.

In production and test environments, the configuration to done through 3 environement variables :

  • STATSD_HOST: The hostname of the server hosting the statsd daemon
  • STATSD_PORT: The port number to use
  • STATSD_PREFIX: The prefix to prepend to all the metrics, used to identify the platform and the app.

In order to test your configuration, you can use the tools/emitter.js script to send a test metric to your statsd daemon every one second.