mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
metrics
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const ip = require('ip');
|
||||
const localIp = ip.address();
|
||||
const PORT = process.env.HTTP_PORT || 3000;
|
||||
const assert = require('assert');
|
||||
|
||||
function installSrfLocals(srf, logger) {
|
||||
if (srf.locals.dbHelpers) return;
|
||||
assert(!srf.locals.dbHelpers);
|
||||
|
||||
const {getSBC, getSrf} = require('./sbc-pinger')(logger);
|
||||
|
||||
const freeswitch = process.env.JAMBONES_FREESWITCH
|
||||
.split(',')
|
||||
.map((fs) => {
|
||||
@@ -15,6 +15,9 @@ function installSrfLocals(srf, logger) {
|
||||
});
|
||||
logger.info({freeswitch}, 'freeswitch inventory');
|
||||
|
||||
const StatsCollector = require('jambonz-stats-collector');
|
||||
const stats = srf.locals.stats = new StatsCollector(logger);
|
||||
|
||||
const {
|
||||
lookupAppByPhoneNumber,
|
||||
lookupAppBySid,
|
||||
@@ -51,8 +54,11 @@ function installSrfLocals(srf, logger) {
|
||||
serviceUrl: `http://${localIp}:${PORT}`,
|
||||
getSBC,
|
||||
getSrf,
|
||||
getFreeswitch: () => freeswitch[0]
|
||||
getFreeswitch: () => freeswitch[0],
|
||||
stats: stats
|
||||
});
|
||||
|
||||
logger.debug({locals: srf.locals}, 'srf.locals installed');
|
||||
}
|
||||
|
||||
module.exports = installSrfLocals;
|
||||
|
||||
Reference in New Issue
Block a user