Add Prometheus metrics
Integration with NextJS is a little awkward, especially because I want it to work with the auto-reloading dev server.
It seems the NextJS "middleware" feature can only run before a request handler, not after, so it can't be used to measure duration or errors. Hence this decorator function.