From 7af9e3bbcf69c8093947882dc502268025505a0b Mon Sep 17 00:00:00 2001 From: Jason Etcovitch Date: Wed, 27 Jan 2021 17:54:51 -0500 Subject: [PATCH] Use tags to mark individual middleware (#17531) --- lib/instrument-middleware.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/instrument-middleware.js b/lib/instrument-middleware.js index 748fb6ef9c..0ac2d80c8b 100644 --- a/lib/instrument-middleware.js +++ b/lib/instrument-middleware.js @@ -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.` - 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) }