Skip to main content
FastAPI is a modern, high-performance web framework for building APIs with Python.

Installation

🐍 Don’t forget to install the AppSignal for Python package in your application first.
First, install the opentelemetry-instrumentation-fastapi package. To add it to your project, add the following line to your requirements.txt file:
# requirements.txt
opentelemetry-instrumentation-fastapi

Setup

Start AppSignal and define your FastAPI application. Then use the FastAPIInstrumentor to instrument your FastAPI application:
# 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)