As a long time express and koa user, I've written a bunch of code to force my applications to only register middlewares via wrappers that name/label middleware, and record self-time and total-time metrics. Surely others have done this as well. I'm regularly wanting to...
- get perf datas during my req/res lifecycle, per middleware
- setup debug logs to see when/why a req terminates in my middleware stack, or similarly
- observe the selected middleware graph for any given req/res flow
- dump the whole middleware graph, particularly because middleware plugins oft bring their own middlewares, e.g. as routers
I think the functional nature of middleware oriented programming is excellent, but oft find it has sharp edges with respect to common diagnostics/reporting.
Are there any known libraries in the pro-node.js-middleware-oriented ecosystem that are well-established and yield such properties? Cursory google searching didn't yield results, but I surmise many others have built similar things.