title: How can I monitoring a flask app without modifying his code?
body: <p>I've been making a little system to monitoring a flask app and others (postgres database, linux server, etc) with prometheus. Everything is going well, but I would like monitoring my flask app without modifying the code. </p>
  
  <p>For example to monitoring methods of my app I did: </p>
  
  <pre><code># Create a metric to track time spent and requests made.
  REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')
  
  @app.route('/')
  @REQUEST_TIME.time()
  def index():
   myUser = User.query.all()
   return render_template('add_user.html', myUser= myUser)
  </code></pre>
  
  <p>I used <a href="https://github.com/prometheus/client_python" rel="nofollow noreferrer">this</a> python library.</p>
  
  <p>Also, I used <a href="https://github.com/sbarratt/flask-prometheus" rel="nofollow noreferrer">other library</a> to monitoring a flask app:</p>
  
  <pre><code>monitor(app, port=9999)
  </code></pre>
  
  <p>unfortunately both are modifying my code. I want to monitoring my flask app without modifying his code. It is possible?  </p>