Skip to content

Sample app to demonstrate instrumenting Python FastAPI Uvicorn app with Datadog, Elastic, New Relic and OpenTelemetry.

License

Notifications You must be signed in to change notification settings

cubeapm/sample_app_python_fastapi_uvicorn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python FastAPI Uvicorn Instrumentation

This is a sample app to demonstrate how to instrument Python FastAPI Uvicorn app with Datadog, Elastic, New Relic and OpenTelemetry. It contains source code for the FastAPI Uvicorn app which interacts with various services like Redis, MySQL, etc. to demonstrate tracing for these services. This repository has a docker compose file to set up all these services conveniently.

The code is organized into multiple branches. The main branch has the FastAPI Uvicorn app without any instrumentation. Other branches then build upon the main branch to add specific instrumentations as below:

Branch Instrumentation Code changes for instrumentation
main None -
datadog Datadog main...datadog
elastic Elastic main...elastic
newrelic New Relic main...newrelic
otel OpenTelemetry main...otel

Setup

Clone this repository and go to the project directory. Then run the following commands

python3 -m venv .
source ./bin/activate
pip install -r requirements.txt
docker compose up --build

FastAPI app will now be available at http://localhost:8000.

The app has various API endpoints to demonstrate integrations with Redis, MySQL, etc. Check out main.py for the list of API endpoints.

Contributing

Please feel free to raise PR for any enhancements - additional service integrations, library version updates, documentation updates, etc.

About

Sample app to demonstrate instrumenting Python FastAPI Uvicorn app with Datadog, Elastic, New Relic and OpenTelemetry.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •