node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »


Build Status


Used for collecting data into discrete 60 second time slices. So say you're at 23:45:12 and you want to collect data for the previous slice of 60 seconds. That is, you want to get data starting from 23:44:00 and going to 23:44:59, not from 23:44:12. This can be used for supplying data to 3rd party libraries such as Graphite.

Currently there is support for push and incr


Used for values such as response times where you want to collect a lot of them and then find the min, max, avg, etc.


Used for incremental values such as total number of users.



npm install


var ts = require('ts');

ts.setup({ push: ['response'] }, function(err) {
  ts.push('response', 56);
  ts.push('response', 129);
  ts.push('response', 23);

  // After a minute
  ts.fields('push', function(err, results) {
    console.log(results); // { response: [56, 129, 23] }


Included is express.js middleware which can be used to record response times. Be sure it comes before the inclusion of app.router.


// Declare routes…

ts.setup({ push: ts.parseRoutes(app) });

The name for a particular route is in the form of (METHOD/path/:id). So response times for'/books') would be listed under (POST/books) while response times for app.get('/books/:id') would be under (GET/books/:id).


By default the Redis client is mocked out. You can either pass true or ts.start to force a connection to Redis.

ts.start('myAppKey', true, function(err, connected) {
  // Connected using the default localhost:6379

You can also specify the connection yourself.

var redis = require('redis');
ts.redis.createClient = function() {
  return redis.createClient();


MIT License