This is a demo of the Rotel Python integration with the FastAPI project. Using the FastAPI instrumentation, it will emit trace spans that can be sent to any compatible tracing vendor. See the Enabling Rotel section below for how to enable Rotel and OpenTelemetry for your own FastAPI project.
This is the backend component from the fullstack FastAPI demo template. For full instructions on how to run the FastAPI backend, see the FastAPI README.
Copy the .env.example to .env and set the appropriate environment variables.
This project uses the uv project manager, to install dependencies run:
uv syncRun a server listening on http://127.0.0.1:10000:
uv run uvicorn app.main:app --host 0.0.0.0 --port "10000" --workers 2Test that the server is running:
curl http://127.0.0.1:10000/api/v1/utils/health-check/See the initialize_tracing method in main.py for how we enable OpenTelemetry tracing and Rotel to emit traces to Axiom.
To start the server with Rotel enabled, set the following environment variables before starting the server:
export AXIOM_API_KEY=xaat-xxxxxxxx
export AXIOM_DATA_SET=my-data-set
uv run uvicorn app.main:app --host 0.0.0.0 --port "10000" --workers 2This project can also be deployed to Render using the provided build and run scripts. Fork this repo and connect it to Render, setting the following script paths in the app config. Set the environment variables as needed in Render's configuration section.
- Build: render-build.sh
- Run: render-start.sh
Do you have questions about this project or want to share your feedback? Join our Discord server where we'd be happy to discuss this integration. See you there! 🚀