https://github.com/joeriddles/python-otel-demo
A Demo for OpenTelemetry in Python
https://github.com/joeriddles/python-otel-demo
Last synced: over 1 year ago
JSON representation
A Demo for OpenTelemetry in Python
- Host: GitHub
- URL: https://github.com/joeriddles/python-otel-demo
- Owner: joeriddles
- Created: 2023-12-16T23:09:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-17T05:30:12.000Z (over 1 year ago)
- Last Synced: 2025-03-26T02:45:46.165Z (over 1 year ago)
- Language: Python
- Size: 8.57 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo of using OpenTelemetry with a Python API
Sample code for a blog post: https://intellitect.com/blog/opentelemetry-metrics-python/
## Local development
### Getting started
```shell
python3 -m venv .venv
source .venv/bin/activate # or Windows equivalent
pip install -r requirements.txt
```
### Running
To start the FastAPI web server:
```shell
make run
```
To start the web server with auto instrumentation that logs to the console:
```shell
make distro_console
```
To start the web server with auto instrumentation that connects to the local docker OTel collector container:
```shell
pip uninstall -r requirements/azure.txt
pip install -r requirements/distro.txt
docker compose up -d
make distro
```
To start the version of the app with Azure Metrics:
```shell
pip uninstall -r requirements/distro.txt
pip install -r requirements/azure.txt
make az
```