openhim-core
Version:
The OpenHIM core application that provides logging and routing of http requests
34 lines (23 loc) • 838 B
JavaScript
var SDC, application, config, domain, os, sdc, statsdServer, tcpAdapter;
tcpAdapter = require('../tcpAdapter');
config = require('../config/config');
statsdServer = config.get('statsd');
application = config.get('application');
SDC = require('statsd-client');
os = require('os');
domain = (os.hostname()) + "." + application.name + ".appMetrics";
sdc = new SDC(statsdServer);
exports.koaMiddleware = function*(next) {
var startTime, transaction;
if (statsdServer.enabled) {
startTime = new Date();
}
transaction = tcpAdapter.popTransaction(this.body);
this.body = transaction.data;
this.authorisedChannel = transaction.channel;
if (statsdServer.enabled) {
sdc.timing(domain + ".retrieveTCPTransactionMiddleware", startTime);
}
return (yield next);
};
//# sourceMappingURL=retrieveTCPTransaction.js.map