Middleware ordering prevents accurate latency measurement
warningconfigurationUpdated Feb 23, 2026(via Exa)
Technologies:
How to detect:
PrometheusBeforeMiddleware not placed first or PrometheusAfterMiddleware not placed last in MIDDLEWARE list. Results in inaccurate request latency metrics that don't capture full request processing time, missing overhead from other middleware.
Recommended action:
Edit settings.py MIDDLEWARE list. Place django_prometheus.middleware.PrometheusBeforeMiddleware as the first entry. Place django_prometheus.middleware.PrometheusAfterMiddleware as the last entry. Restart application to apply changes.