From be2c6a96af8256c7a56dfdddaf37efb263a26dda Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 17 Mar 2017 14:20:13 +0000 Subject: [PATCH] Log args and their indexes, if they look like object ids --- libraries/metrics/timeAsyncMethod.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/metrics/timeAsyncMethod.coffee b/libraries/metrics/timeAsyncMethod.coffee index bd4743930c..7ec64f3d41 100644 --- a/libraries/metrics/timeAsyncMethod.coffee +++ b/libraries/metrics/timeAsyncMethod.coffee @@ -21,5 +21,10 @@ module.exports = (obj, methodName, prefix, logger) -> realMethod.call this, firstArgs..., (callbackArgs...) -> elapsedTime = timer.done() if logger? - logger.log {key, elapsedTime}, "[Metrics] timed async method call" + loggableArgs = {} + try + for arg, idx in firstArgs + if arg.toString().match(/^[0-9a-f]{24}$/) + loggableArgs["#{idx}"] = arg + logger.log {key, args: loggableArgs, elapsedTime}, "[Metrics] timed async method call" callback.apply this, callbackArgs