在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:AfterShip/deprecated-koa-newrelic开源软件地址:https://github.com/AfterShip/deprecated-koa-newrelic开源编程语言:JavaScript 100.0%开源软件介绍:koa-newrelicKoa middleware to allow Newrelic monitor Koa applications like Express. Supported features:
koa 1.xSee koa-newrelic 1.x for koa 1.x support. Installation
APIconst newrelic = require('newrelic');
const koaNewrelic = require('koa-newrelic')(newrelic, opts);
const Koa = require('koa');
const Router = require('koa-router');
const views = require('koa-views');
const app = new Koa();
const router = new Router;
router.get('/', async function (next) {...});
app
.use(koaNewrelic);
.use(views()) // use views middleware could help instrument ctx.render method
.use(router.routes()); To record traces of middlewares, please initialize koa-newrelic before adding any middlewares to Options
Examplesconst koaNewrelic = require('koa-newrelic')(newrelic, {
renderMethodName: 'render',
middlewareTrace: true,
groupStaticResources: true,
staticExtensions: ['js', 'css'],
customTransactionName: (method, path) => `Koajs/${path.slice(1)}#${method}`
});
router.get('/index', async function ctrA(ctx) {...});
router.post('/login', async function ctrB(ctx) {...});
app
.use(koaNewrelic)
.use(serve('/public'));
.use(router.routes());
/*
In Newrelic, you will find following transactions
/index#GET
Middleware serve
Middleware dispatch
Middleware ctrA
/login#POST
Middleware serve
Middleware dispatch
Middleware ctrB
/*.js#GET
Middleware serve
/*.css#GET
Middleware serve
*/ Test
Known IssuesLicenseCopyright (c) 2017 AfterShip Licensed under the MIT license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论