django-prometheus
django-prometheus copied to clipboard
Add config in settings to allow using a prefix for metrics
Hi!
I think adding a prefix to metrics of each app/service is a good practice. Especially in bigger companies that have a Prometheus server, monitoring a lot of apps/services. So why not implement it in the library?
I will submit a PR upon approval. And I think a good implementation would be to have something like this in Django settings and then using it as the prefix of exposed metrics (if present ofc).
django_settings:
DJANGO_PROMETHEUS = {
'METRICS_PREFIX': 'sth_sth_sth',
}
this already exists... see PROMETHEUS_METRIC_NAMESPACE it does that using the python-client namespace property added to metrics. https://github.com/prometheus/client_python/blob/ccb8395265e3745098f3aef1b5ad34ac869e0bc7/README.md#process-collector
Well, my bad :)) I also followed your link and there was no explicit reference to this setting. Maybe adding it to the documentation of this repo helps.