FastAPI Instrumentation
This feature requires AppSignal for Python version 0.1.4 or higher.
This feature requires FastAPI version 0.58 or higher.
FastAPI is a modern, high-performance web framework for building APIs with Python.
Installation
First, install the opentelemetry-instrumentation-fastapi
package. To add it to your project, add the following line to your requirements.txt
file:
Shell
# requirements.txt opentelemetry-instrumentation-fastapi
Setup
Start AppSignal and define your FastAPI application. Then use the FastAPIInstrumentor
to instrument your FastAPI application:
Python
# app.py from fastapi import FastAPI from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor import appsignal appsignal.start() app = FastAPI() # ... your app's code goes here ... FastAPIInstrumentor().instrument_app(app)