동료가이 문제를 해결하는 데 도움이됩니다.
솔루션은 여기
//****************** myKoaNewRelic.js *****************
'use strict'
module.exports = function monitor(router, newrelic) {
return function* monitor(next) {
const route = this.params[0]
for (const layer of router.stack) {
if (layer.path !== '(.*)') {
const method = (layer.methods.indexOf('HEAD') !== -1) ? layer.methods[1] : layer.methods[0]
if (route.match(layer.regexp) && method === this.request.method) {
newrelic.setControllerName(layer.path, method)
}
}
}
yield next
}
}
2.update 주하는 index.js이
//****************** index.js *****************
'use strict'
const newrelic = require('newrelic')
const koaNewrelic = require('./myKoaNewRelic')
const app = require('koa')()
const router = require('koa-router')()
router.use(koaNewrelic(router, newrelic))
// DO SOME STUFF
같은
1.declare 사용자 정의 KOA 새로운 유물 아래 당신이 KOA-newrelic 또는 KOA를 시도 - 루터 - 뉴럴릭? –
그래,하지만 그 시간에 작동하지 않습니다. 그것이 작동하는지 아닌지 나는 확신 할 수 없다. –