repo sync
This commit is contained in:
@@ -10,10 +10,10 @@ module.exports = function instrumentMiddleware (relativePath) {
|
||||
// Check if the middleware is an async function, to use the appropriate timer
|
||||
const isAsyncFunction = middleware.constructor.name === 'AsyncFunction'
|
||||
|
||||
// Name it `middleware.<filename>`
|
||||
const name = `middleware.${path.basename(relativePath)}`
|
||||
// Add a tag so we can see all middleware together
|
||||
const tags = { middleware: path.basename(relativePath) }
|
||||
|
||||
return isAsyncFunction
|
||||
? statsd.asyncTimer(middleware, name)
|
||||
: statsd.timer(middleware, name)
|
||||
? statsd.asyncTimer(middleware, 'middleware', tags)
|
||||
: statsd.timer(middleware, 'middleware', tags)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user