Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't import celery in monitoring if it's disabled #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from django_prometheus.exports import ExportToDjangoView
from prometheus_client import multiprocess

{%- if cookiecutter.use_celery == "y" -%}
from ..celery import get_num_tasks_in_queue

{% endif %}

class RecursiveMultiProcessCollector(multiprocess.MultiProcessCollector):
"""A multiprocess collector that scans the directory recursively"""
Expand All @@ -35,7 +36,7 @@ def metrics_view(request):
else:
return ExportToDjangoView(request)


{%- if cookiecutter.use_celery == "y" -%}
num_tasks_in_queue = {}
for queue in settings.CELERY_TASK_QUEUES:
gauge = prometheus_client.Gauge(
Expand All @@ -44,4 +45,5 @@ def metrics_view(request):
)
num_tasks_in_queue[queue.name] = gauge
gauge.set_function(partial(get_num_tasks_in_queue, queue.name))
{% endif %}
{% endif %}
Loading