koa-aliyun-monitor
v1.0.1
Published
A monitor middleware for koa integrated with koa-metrics and aliyun-monitor
Downloads
5
Maintainers
Readme
koa-aliyun-monitor
A monitor middleware integrated with koa-monitor and aliyun-monitor
Quick start
准备工作
- 在阿里云监控控制台创建自定义规则,设置字段为
method,url,hostname
- 若要监控响应时间,选择单位为Milliseconds;监控请求次数,选择Count;注意:一个监控项只能监控一个指标
- 记录新创建规则的命名空间为
namespace
,监控项名称为metricName
Example code
const Monitor = require('koa-aliyun-monitor');
const Koa = require('koa');
let app = new Koa();
app.use(Monitor);
Monitor.createResponseTimeMonitor('your namespace', 'your metricName');
Monitor.createRequestCountMonitor('another namespace', 'another metricName');
//Add other all middlewares after this
// app.use(some middleware);
app.listen();