Skip to content

fabriciodf/otel_lgtm_py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📦 FastAPI + OpenTelemetry + LGTM Stack (Grafana Observability)

This project demonstrates how to instrument a Python FastAPI application using OpenTelemetry, and export logs, metrics, and traces to a local Grafana LGTM stack via OTLP.


🔭 Stack Overview

  • ⚙️ FastAPI app with OpenTelemetry instrumentation
  • 📦 Grafana OTEL-LGTM Docker image for observability pipeline:
    • Loki for logs
    • Grafana for dashboards
    • Tempo for traces
    • Mimir for metrics
  • 🚀 Deployment via docker-compose
  • 🛠️ Includes run.sh automation script

🚀 Getting Started

1. Clone this repository

git clone git@github.com:fabriciodf/otel_lgtm_py.git
cd otel_lgtm_py

2. Run the stack

chmod +x run.sh
./run.sh

This will:

  • Remove existing containers/images
  • Build your FastAPI image
  • Start the FastAPI app and LGTM stack via Docker

3. Access the stack

4. 🌐 Telemetry Details

The FastAPI container is instrumented with:

OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-lgtm:4317
OTEL_SERVICE_NAME=fastapi-otel
OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=otlp
OTEL_LOGS_EXPORTER=otlp

OpenTelemetry sends: Logs → Loki Traces → Tempo Metrics → Mimir

All visualized via Grafana dashboards

5. 📁 Project Structure

.
├── Dockerfile
├── docker-compose.yml
├── main.py
├── run.sh
└── requirements.txt

6. 🛠️ Built With

FastAPI OpenTelemetry Python SDK Grafana LGTM Docker image Docker Compose

7. 📜 License

MIT License © fabriciodf

About

Testing Otel LGTM + Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors