This project has the following services:
- api allows you to get, post raw information and get analyzed metrics;
- metrics_generator that generate fake metrics;
- db PostgreSQL
- otel-collector - collect trace_id
- tempo
- grafana - visualize spans
- FastAPI
- Python3.10
- Aiohttp
- Flask
- PostgreSQL
- Grafana
- Tempo
- OTLP instrumentation
- Docker, docker compose
Create .env file and set the following environmental variables, if you don't want to use default values:
Environmental | Description |
---|---|
SECRET_KEY |
db secret key |
POSTGRES_USER |
db username |
POSTGRES_PASSWORD |
db password |
POSTGRES_SERVER |
db hostname (name of docker compose service) |
POSTGRES_PORT |
port for connection to db |
POSTGRES_DB |
db table |
docker compose up -d
Swagger API: http://127.0.0.1:5000/docs
- Get analyzed metrics: http://127.0.0.1:5000/analyzed_metrics/1, where last num - amount of data portion, the more, the longer request (you can see it in grafana)
- Get trace_id in log in stdout
- Paste trace_id in grafana http://127.0.0.1:3000/explore
- See time of tracing network connections or/and sql queries.
For example: http://127.0.0.1:5000/api/analyzed_metrics/1 -> 187.85ms
http://127.0.0.1:5000/api/analyzed_metrics/10 -> 1.77s
Also, it works with database queries like http://127.0.0.1:5000/api/teams/1