1
0
mirror of synced 2026-01-05 12:07:35 -05:00

repo sync

This commit is contained in:
Octomerger Bot
2021-01-28 09:10:19 +10:00
committed by GitHub

View File

@@ -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)
}