Use Python's logging module with structured (JSON) logs in production, include a request ID generated in middleware (or taken from an incoming header) in every log line, and log latency, status code and errors without sensitive data.
Add metrics (Prometheus) and distributed tracing (OpenTelemetry) for production services, and error tracking such as Sentry.
Loading…