app: debug: add hot ips

This commit is contained in:
DIYgod
2018-05-17 15:48:35 +08:00
parent 77014458d0
commit 005670acee
4 changed files with 34 additions and 0 deletions

View File

@@ -4,6 +4,12 @@ module.exports = async (ctx, next) => {
}
ctx.debug.routes[ctx.request.path]++;
const ip = ctx.ips[0] || ctx.ip;
if (!ctx.debug.ips[ip]) {
ctx.debug.ips[ip] = 0;
}
ctx.debug.ips[ip]++;
if (ctx.request.path !== '/') {
ctx.debug.request++;
}