Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix config of observability tasks (#16053)

Marcin Gębala5ce381325744
diff --git a/saleor/settings.py b/saleor/settings.py
index 036e095975..4ac56a1c21 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -545,14 +545,6 @@ CELERY_ACCEPT_CONTENT = ["json"]
CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = "json"
CELERY_RESULT_BACKEND = os.environ.get("CELERY_RESULT_BACKEND", None)
-CELERY_TASK_ROUTES = {
- "saleor.plugins.webhook.tasks.observability_reporter_task": {
- "queue": "observability"
- },
- "saleor.plugins.webhook.tasks.observability_send_events": {
- "queue": "observability"
- },
-}
# Expire orders task setting
BEAT_EXPIRE_ORDERS_AFTER_TIMEDELTA = timedelta(
@@ -696,7 +688,7 @@ OBSERVABILITY_BUFFER_TIMEOUT = timedelta(
)
if OBSERVABILITY_ACTIVE:
CELERY_BEAT_SCHEDULE["observability-reporter"] = {
- "task": "saleor.plugins.webhook.tasks.observability_reporter_task",
+ "task": "saleor.webhook.transport.asynchronous.transport.observability_reporter_task", # noqa
"schedule": OBSERVABILITY_REPORT_PERIOD,
"options": {"expires": OBSERVABILITY_REPORT_PERIOD.total_seconds()},
}
diff --git a/saleor/webhook/transport/asynchronous/transport.py b/saleor/webhook/transport/asynchronous/transport.py
index 0041355f07..d5fda42849 100644
--- a/saleor/webhook/transport/asynchronous/transport.py
+++ b/saleor/webhook/transport/asynchronous/transport.py
@@ -44,6 +44,8 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__)
task_logger = get_task_logger(__name__)
+OBSERVABILITY_QUEUE_NAME = "observability"
+
def create_deliveries_for_subscriptions(
event_type,
@@ -330,7 +332,7 @@ def send_observability_events(webhooks: list[WebhookData], events: list[bytes]):
)
[email protected](queue=OBSERVABILITY_QUEUE_NAME)
def observability_send_events():
with observability.opentracing_trace("send_events_task", "task"):
if webhooks := observability.get_webhooks():
@@ -341,7 +343,7 @@ def observability_send_events():
send_observability_events(webhooks, events)
[email protected](queue=OBSERVABILITY_QUEUE_NAME)
def observability_reporter_task():
with observability.opentracing_trace("reporter_task", "task"):
if webhooks := observability.get_webhooks():