Flask¶
The logfire.instrument_flask() method
Create will a span for every request to you Flask application.
Install¶
Install logfire with the flask extra:
{{ install_logfire(extras=['flask']) }}
Usage¶
Let's see a minimal example below. Ты можешь run it with python main.py:
main.py
import logfire
from flask import Flask
logfire.configure()
app = Flask(__name__)
logfire.instrument_flask(app)
@app.route("/")
def hello():
return "Hello!"
if __name__ == "__main__":
app.run(debug=True)
The keyword arguments of logfire.instrument_flask() are passed to the FlaskInstrumentor().instrument_app() method
Off the OpenTelemetry Flask Instrumentation package, read more about it here
Capturing request and response headers¶
本文总阅读量次