timeMe() expression execution timer
[I've reached the limit of two consecutive posts again so posting this here temporarily until someone else posts something and then I can post it seperately.]
This function injects an MDC1 filter key into the logging system during expression execution, allowing a specific expression’s activity to be easily located in the logs.
1 Mapped Diagnostic Context.
Expression
timeMe(
'timeMeLog', // string to be returned with the MDC.
forEach( // sample expression to be timed.
asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
asMap(
'Number', it(),
'Square', it() ^ 2
)
)
)
Results available in gateway web page → Status → Logs.
Note the MDC string from the script.