Fix linting
This commit is contained in:
parent
553ba9db9a
commit
bb5189c9ed
35 changed files with 157 additions and 866 deletions
|
@ -3,7 +3,7 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Stats = require('statsy');
|
||||
const Stats = require('statsy');
|
||||
|
||||
/**
|
||||
* Initialize stats middleware with `opts`
|
||||
|
@ -14,14 +14,13 @@ var Stats = require('statsy');
|
|||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(opts){
|
||||
opts = opts || {};
|
||||
var s = new Stats(opts);
|
||||
export default function (opts) {
|
||||
const s = new Stats(opts || {});
|
||||
|
||||
return async (ctx, next) => {
|
||||
// counters
|
||||
s.incr('request.count');
|
||||
s.incr('request.' + ctx.method + '.count');
|
||||
s.incr(`request.${ctx.method}.count`);
|
||||
|
||||
// size
|
||||
s.histogram('request.size', ctx.request.length || 0);
|
||||
|
@ -33,5 +32,5 @@ module.exports = function(opts){
|
|||
ctx.res.on('finish', s.timer('request.duration'));
|
||||
|
||||
await next();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue