title: How to collect performance metrics in a Flask Application?
body: <p>What would be the best way to collect metrics on all HTTP requests made to a flask Application.</p>
  
  <p>Things I would like to measure are : </p>
  
  <ul>
  <li>Latency - time for each request. </li>
  <li>Rate - No. of requests per minute etc.</li>
  <li>No of failures - If there is a failure, how many etc.</li>
  </ul>
  
  <p>Also I want to group requests to a variable path as one. For e.g All requests to the route '/resource/' should be measured for the metric named "RESOURCE" and not individually for each resource.</p>
  
  <p>I plan to do this currently by writing a decorator. The disadvantage being I need to add the decorator for each method.
  Are there ways in which Flask can provide me hooks to measure these automatically.</p>