I'm writing a metrics plugin for Klein and I can't figure out how to inject a metrics handler so that I can get route, path, duration, and status code. What I'm doing now sucks because Klein and twisted interact in complex ways on Failure and status codes.
# Replace the klein _call with the metrics generating call
_app._call = _callWithMetrics
Rather than replace _call with my version of _call I was hoping there was a cleaner way to get the start and stop with the result code of a route invocation. Thoughts?