Skip to main content
Starlette is a lightweight, high-performance web framework for building asynchronous Python applications.

Installation

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

Setup

Start AppSignal and define your Starlette application. Then use the StarletteInstrumentor to instrument your Starlette application:
# app.py
from starlette.applications import Starlette
from opentelemetry.instrumentation.starlette import StarletteInstrumentor

import appsignal
appsignal.start()

# ... your application's code goes here ...

app = Starlette(
  # ...
)

StarletteInstrumentor().instrument_app(app)