egg-qwatcher

2.0.0 • Public • Published

egg-qwatcher

qunar watcher for egg

Install

$ npm i egg-qwatcher --save

Usage

// {app_root}/config/plugin.js
exports.qwatcher = {
  enable: true,
  package: 'egg-qwatcher',
};

Configuration

// {app_root}/config/config.default.js
exports.qwatcher = {
    // 项目
    projectId: 'event_node',
    host: 'host',
    port: 2013,
    // 类别
    category: 't.fe.beta'
};

如果出现错误,会往 common-error.log 中记录,而不会抛出异常。

see config/config.default.js for more detail.

Example

记录某个指标次数

// 单指标
yield app.qwatcher.recordCount('api_perfect')

// 多指标同时记录
yield app.qwatcher.recordCount('api_perfect', 'api_entrence')

记录某个指标的时间值

// 单指标
yield app.qwatcher.recordTime('api_perfect', 120)

// 多指标同时记录,比如记录页面加载时间等
yield app.qwatcher.recordTime({
  dns: 10,
  ready: 20
})

Questions & Suggestions

Please open an issue here.

Version

2.0.0版本以上为egg2版本插件

License

MIT

Package Sidebar

Install

npm i egg-qwatcher

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

10.7 kB

Total Files

8

Last publish

Collaborators

  • happybo
  • munch_tzb
  • xbf321