You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a label_metric() method to django_prometheus.middleware.AppMetricsBeforeMiddleware which would function identically to django_prometheus.middleware.AppMetricsAfterMiddleware.label_metric(), which already exists.
Use case
The ability to apply labels unconditionally to all emitted metrics. For example, applying the namespace label allows the django_prometheus grafana dashboard to query on a namespace label: https://grafana.com/grafana/dashboards/9528-django-prometheus/
📣 If the authors are amenable to this change, I'm happy to implement it and open a PR
The text was updated successfully, but these errors were encountered:
Background
At present, metrics emitted by AppMetricsBeforeMiddleware are not labeled and no hook exists to apply ad-hoc labels to these metrics; see:
django-prometheus/django_prometheus/tests/end2end/testapp/test_middleware_custom_labels.py
Lines 19 to 46 in a304687
Proposal
Add a
label_metric()
method todjango_prometheus.middleware.AppMetricsBeforeMiddleware
which would function identically todjango_prometheus.middleware.AppMetricsAfterMiddleware.label_metric()
, which already exists.Use case
The ability to apply labels unconditionally to all emitted metrics. For example, applying the
namespace
label allows the django_prometheus grafana dashboard to query on anamespace
label: https://grafana.com/grafana/dashboards/9528-django-prometheus/📣 If the authors are amenable to this change, I'm happy to implement it and open a PR
The text was updated successfully, but these errors were encountered: