From f740b2d5b91b0bf23b4baff42c82bed5699a21da Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 12 Nov 2024 12:24:48 +0330 Subject: [PATCH 1/2] feat: enabling tracing for amqp server! --- routers/amqp.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/routers/amqp.py b/routers/amqp.py index f4f45eb..5ba680d 100644 --- a/routers/amqp.py +++ b/routers/amqp.py @@ -8,6 +8,7 @@ from tc_messageBroker.rabbit_mq.event import Event from tc_messageBroker.rabbit_mq.queue import Queue from utils.credentials import load_rabbitmq_credentials +from utils.traceloop import init_tracing from utils.persist_payload import PersistPayload from worker.tasks import query_data_sources from worker.utils.fire_event import job_send @@ -29,7 +30,7 @@ async def ask(payload: Payload, logger: Logger): try: question = payload.content.question.message community_id = payload.content.communityId - + init_tracing() logger.info(f"COMMUNITY_ID: {community_id} Received job") response = query_data_sources(community_id=community_id, query=question) logger.info(f"COMMUNITY_ID: {community_id} Job finished") @@ -45,11 +46,6 @@ async def ask(payload: Payload, logger: Logger): persister = PersistPayload() persister.persist_amqp(response_payload) - # result = Payload( - # event=payload.content.route.destination.event, - # date=str(datetime.now()), - # content=response_payload.model_dump(), - # ) job_send( event=payload.content.route.destination.event, queue_name=payload.content.route.destination.queue, From bda2859c626c1a9b1cbe7d25f8c60ff76426c549 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 12 Nov 2024 12:30:39 +0330 Subject: [PATCH 2/2] fix: isort lint issue! --- routers/amqp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/amqp.py b/routers/amqp.py index 5ba680d..fbbf3ab 100644 --- a/routers/amqp.py +++ b/routers/amqp.py @@ -8,8 +8,8 @@ from tc_messageBroker.rabbit_mq.event import Event from tc_messageBroker.rabbit_mq.queue import Queue from utils.credentials import load_rabbitmq_credentials -from utils.traceloop import init_tracing from utils.persist_payload import PersistPayload +from utils.traceloop import init_tracing from worker.tasks import query_data_sources from worker.utils.fire_event import job_send