Skip to content

Label HTTP metrics by whether the user is logged in

It would be useful to distinguish latency and error metrics by whether the user is logged in; this often affects permission code paths, and of course scrapers etc. won't typically be logged in.

To achieve this, I think we need to subclass django_prometheus.middleware.PrometheusAfterMiddleware and override the label_metric method to add extra labels based on attributes of the request.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information