egg-instrument
Compute the duration of an operation in local environment.
Install
$ npm i egg-instrument --save
Usage
// {app_root}/config/plugin.jsexportsinstrument = enable: true package: 'egg-instrument';
Instrument can calculate the duration of an operation, for example
// app/controller/home.jsexportsindex = async { const ins = ctx; const data = await ctxservicehome; ins; ctxbody = data;};
Then you can see the infomation in console
2017-01-20 15:32:58,567 INFO 30445 [-/127.0.0.1/-/1024ms GET /] [service] home.getData 1006ms
If you are not in context level, you can use app.instrument
or agent.instrument
.
Configuration
see config/config.default.js for more detail.
Questions & Suggestions
Please open an issue here.