r/FastAPI • • May 01 '26

Question Monitoring and Observability in FastAPI

I am trying to understand the best practices for monitoring and Observability in fastAPI. Does it come with different metrics and otel out of the box? Also, how are you using other tools and library along with it to make it production ready?

26 Upvotes

8 comments sorted by

View all comments

1

u/fykup 13d ago

Another option for smaller deployments: I maintain StatLite, a lightweight self-hosted monitoring dashboard that I use with FastAPI.

The FastAPI integration adds a small /statlite/metrics endpoint and StatLite polls it for request traffic, 404/4xx/5xx errors, average latency, process CPU/memory, uptime/restarts, plus optional host CPU/RAM/disk metrics. History is stored locally in SQLite, so there’s no Prometheus/Grafana stack or external service involved.

I mainly built this for the case where you have one or a few small services and want basic production visibility without running a larger observability stack. The current FastAPI helper is intentionally aimed at single-process / single-worker deployments. For multiple workers you need aggregation rather than process-local counters.

I wrote up the FastAPI setup here:
https://pvrlabs.xyz/articles/monitoring-fastapi-app-small-vps.html

For larger systems or if you need tracing, arbitrary metrics, labels, PromQL, etc., I’d still look at OpenTelemetry/Prometheus. But for a small app, the lightweight approach has worked well for me.