Fastapi
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. FastAPI has been supported for python 3.7 and above by Thundra.
Install
thundra
to your environment by running:pip install --upgrade thundra
Initialize and configure thundra in your fastapi application file before fastapi app is initialized. After that thundra will automatically trace all your fastapi requests.
import thundra
# You can provide configuration options with thundra.configure
# Configure thundra.apikey in here or by setting
# thundra_apiKey environment variable while running your application
thundra.configure(
options={
"config": {
"thundra.apikey": "<your-api-key-here>",
"thundra.agent.application.name": "sample_app", # Sample configuration, not required
}
}
)
Enabling Request Body Tracing
Http request body is not sent to thundra by default. To be able to trace the request body to your endpoints, you can set
THUNDRA_TRACE_REQUEST_SKIP
environment variable to false
or by providing it to options.config as in the below configuration.import thundra
# You can provide configuration options with thundra.configure
# Configure thundra.apikey in here or by setting
# thundra_apiKey environment variable while running your application
thundra.configure(
options={
"config": {
"thundra.apikey": "<your-api-key-here>",
"thundra.agent.application.name": "sample_app", # Sample configuration, not required
"thundra.agent.trace.request.skip": False
}
}
)
Last modified 1yr ago