Skip to content

Commit f2346fc

Browse files
committed
move metrics_collector to contrib.prometheus & other minor suggestions
1 parent 44ca5b2 commit f2346fc

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ Configuring Prometheus
373373

374374
``django_rq`` also provides a Prometheus compatible view, which can be enabled
375375
by installing ``prometheus_client`` or installing the extra "prometheus-metrics"
376-
(``pip install django-rq[prometheus-metrics]``). The metrics are exposed at
376+
(``pip install django-rq[prometheus]``). The metrics are exposed at
377377
``/django-rq/metrics/`` and the following is an example of the metrics that
378378
are exported::
379379

django_rq/metrics_collector.py renamed to django_rq/contrib/prometheus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from rq.job import JobStatus
22

3-
from .queues import filter_connection_params, get_connection, get_queue, get_unique_connection_configs
4-
from .workers import get_worker_class
3+
from ..queues import filter_connection_params, get_connection, get_queue, get_unique_connection_configs
4+
from ..workers import get_worker_class
55

66
try:
77
from prometheus_client import Summary

django_rq/stats_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
try:
1111
import prometheus_client
1212

13-
from .metrics_collector import RQCollector
13+
from .contrib.prometheus import RQCollector
1414
except ImportError:
1515
prometheus_client = RQCollector = None # type: ignore[assignment, misc]
1616

@@ -23,7 +23,7 @@ def prometheus_metrics(request):
2323
global registry
2424

2525
if not RQCollector: # type: ignore[truthy-function]
26-
raise Http404
26+
raise Http404('prometheus_client has not been installed; install using extra "django-rq[prometheus]"')
2727

2828
if not registry:
2929
registry = prometheus_client.CollectorRegistry(auto_describe=True)

django_rq/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.urls import re_path
22

33
from . import stats_views, views
4-
from .metrics_collector import RQCollector
4+
from .contrib.prometheus import RQCollector
55

66
metrics_view = [
77
re_path(r'^metrics/?$', stats_views.prometheus_metrics, name='rq_metrics'),

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
install_requires=['django>=3.2', 'rq>=2', 'redis>=3.5'],
2121
extras_require={
22-
'prometheus-metrics': ['prometheus_client>=0.4.0'],
22+
'prometheus': ['prometheus_client>=0.4.0'],
2323
'Sentry': ['sentry-sdk>=1.0.0'],
2424
'testing': [],
2525
},

0 commit comments

Comments
 (0)