Skip to content

Commit

Permalink
update celery prom server signal
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed May 31, 2024
1 parent f02a415 commit 11c5dbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions memberportal/membermatters/celeryapp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from celery import Celery
from celery.signals import celeryd_init
from celery.signals import worker_init
from prometheus_client import CollectorRegistry, multiprocess, start_http_server
import logging

Expand All @@ -27,8 +27,9 @@ def debug_task(self):
print(f"Request: {self.request!r}")


@celeryd_init.connect
@worker_init.connect
def celery_prom_server(sender=None, conf=None, **kwargs):
print("Starting CollectorRegistry() and multiprocess.MultiProcessCollector()...")
logger.info(
"Starting CollectorRegistry() and multiprocess.MultiProcessCollector()..."
)
Expand Down
1 change: 1 addition & 0 deletions memberportal/membermatters/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
# Enable celery events for danihodovic/celery-exporter
CELERY_WORKER_SEND_TASK_EVENTS = True
CELERY_TASK_SEND_SENT_EVENT = True
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True

# Needed for testing OIDC on local development environment with ngrok (oauth requires HTTPS)
# SITE_URL = "https://1bd0-122-148-148-138.ngrok-free.app"

0 comments on commit 11c5dbf

Please sign in to comment.