stops logging metrics to localdb #1013
2 changed files with 15 additions and 5 deletions
|
@ -20,10 +20,7 @@ const { setupBlockList } = require('./utils/blockList');
|
||||||
const speechPassport = require('./speechPassport');
|
const speechPassport = require('./speechPassport');
|
||||||
const processTrending = require('./utils/processTrending');
|
const processTrending = require('./utils/processTrending');
|
||||||
|
|
||||||
const {
|
const { setRouteDataInContextMiddleware } = require('./middleware/httpContextMiddleware');
|
||||||
logMetricsMiddleware,
|
|
||||||
setRouteDataInContextMiddleware,
|
|
||||||
} = require('./middleware/logMetricsMiddleware');
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
details: { port: PORT, blockListEndpoint },
|
details: { port: PORT, blockListEndpoint },
|
||||||
|
@ -145,7 +142,7 @@ function Server() {
|
||||||
|
|
||||||
app[routeMethod](
|
app[routeMethod](
|
||||||
routePath,
|
routePath,
|
||||||
logMetricsMiddleware,
|
// logMetricsMiddleware,
|
||||||
setRouteDataInContextMiddleware(routePath, routeData),
|
setRouteDataInContextMiddleware(routePath, routeData),
|
||||||
...controllers
|
...controllers
|
||||||
);
|
);
|
||||||
|
|
13
server/middleware/httpContextMiddleware.js
Normal file
13
server/middleware/httpContextMiddleware.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const httpContext = require('express-http-context');
|
||||||
|
|
||||||
|
function setRouteDataInContextMiddleware(routePath, routeData) {
|
||||||
|
return function(req, res, next) {
|
||||||
|
httpContext.set('routePath', routePath);
|
||||||
|
httpContext.set('routeData', routeData);
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
setRouteDataInContextMiddleware,
|
||||||
|
};
|
Loading…
Reference in a new issue