eggjs/egg-instrument

Name: egg-instrument

Owner: egg

Description: Compute the duration of an operation in local environment.

Created: 2017-01-20 06:06:06.0

Updated: 2018-03-30 15:27:14.0

Pushed: 2017-11-23 07:19:49.0

Homepage:

Size: 16

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

egg-instrument

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Compute the duration of an operation in local environment.

Install
m i egg-instrument --save
Usage
app_root}/config/plugin.js
rts.instrument = {
able: true,
ckage: 'egg-instrument',

Instrument can calculate the duration of an operation, for example

pp/controller/home.js
rts.index = async ctx => {
nst ins = ctx.instrument('service', 'home.getData');
nst data = await ctx.service.home.getData();
s.end();
x.body = data;

Then you can see the infomation in console

-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.

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.