JSPM

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

Easy metric tracking and aggregation using Redis

Package Exports

  • redis-metrics

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 (redis-metrics) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

redis-metrics

Easy metric tracking and aggregation using Redis.

This module was originally created to provide an easy way of storing and viewing aggregated counter and trend statistics.

In a sense, the libary tries to provide sugar-coated method calls for storing and fetching Redis data to report counts and trends. The first design goal is to make counting simpler.

Usage

// Create an instance of the me
var RedisMetrics = require('redis-metrics');
var metrics = new RedisMetrics();

// Get a counter for a "pageview" event and increment it three times.
var myCounter = metrics.counter('pageview');
myCounter.incr();
myCounter.incr();
myCounter.incr();

// Fetch the count for myCounter, using a callback.
myCounter.count(function(cnt) {
  console.log(cnt); // Outputs 3 to the console.
});

// Fetch the count for myCounter, using promise.
myCounter.count().then(function(cnt) {
  console.log(cnt); // Outputs 3 to the console.
});

Test

Run tests including code coverage:

$ npm test

Documentation

The internal module documentation is based on jsdoc and can be generated with:

$ npm run-script docs