Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / utils / server-stats.js
blob4c37c5cdcfecab7563dde9534811331d94c5fa5a
1 'use strict';
3 var env = require('gitter-web-env');
4 var logger = env.logger;
5 var stats = env.stats;
6 var shutdown = require('shutdown');
8 module.exports = function(prefix, server) {
9 var timer = setInterval(function() {
10 server.getConnections(function(err, connections) {
11 if (err)
12 return logger.error('Unable to enumerate server connections: ' + err, { exception: err });
13 stats.gaugeHF(prefix + '.connections', connections);
14 });
15 }, 1000);
17 shutdown.addHandler('server-stats', 30, function(callback) {
18 clearTimeout(timer);
19 callback();
20 });