Passer au contenu principal
FastAPI est un framework web Python moderne et performant pour la création d’API avec Python.

Installation

🐍 N’oubliez pas d’installer le paquet AppSignal for Python dans votre application au préalable.
Tout d’abord, installez le package opentelemetry-instrumentation-fastapi. Pour l’ajouter à votre projet, ajoutez la ligne suivante à votre fichier requirements.txt :
# requirements.txt
opentelemetry-instrumentation-fastapi

Configuration

Démarrez AppSignal et définissez votre application FastAPI. Utilisez ensuite FastAPIInstrumentor pour instrumenter votre application FastAPI :
# 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)