Implement metrics timing middleware.