我一直在制作一个小系统来使用 prometheus 监控烧瓶应用程序和其他应用程序(postgres 数据库、linux 服务器等)。一切进展顺利,但我想在不修改代码的情况下监控我的烧瓶应用程序。
例如,为了监控我的应用程序的方法,我做了:
# 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)
我使用了这个python 库。
此外,我使用其他库来监控烧瓶应用程序:
monitor(app, port=9999)
不幸的是,两者都在修改我的代码。我想在不修改他的代码的情况下监控我的烧瓶应用程序。有可能的?