diff --git a/aiopika_macrobase/endpoint.py b/aiopika_macrobase/endpoint.py index df72b23..2cde2d8 100644 --- a/aiopika_macrobase/endpoint.py +++ b/aiopika_macrobase/endpoint.py @@ -7,6 +7,7 @@ from aio_pika import IncomingMessage from structlog import get_logger +from macrobase_driver.logging import set_request_id log = get_logger('macrobase.aiopika.endpoint') @@ -30,6 +31,7 @@ async def handle(self, driver, message: IncomingMessage, data, *args, **kwargs) AiopikaResult: Aiopika result action or None (if return None then driver ack message). """ try: + set_request_id(message.headers.get('x-cross-request-id')) result = await self.method(driver, message, data, *args, **kwargs) except Exception as e: capture_exception(e) diff --git a/aiopika_macrobase/rpc/client.py b/aiopika_macrobase/rpc/client.py index c5b3e61..06adb1d 100644 --- a/aiopika_macrobase/rpc/client.py +++ b/aiopika_macrobase/rpc/client.py @@ -16,6 +16,7 @@ from aio_pika.message import DeliveredMessage from logging import getLogger +from macrobase_driver.logging import get_request_id log = getLogger('AiopikaClient') @@ -240,6 +241,7 @@ async def _get_message(self, body, content_type: str, type: str, correlation_id: headers={ 'lang': 'py', 'method': identifier, + 'x-cross-request-id': get_request_id(), # 'id': correlation_id, # 'shadow': shadow, # 'countdown': countdown, diff --git a/setup.py b/setup.py index 9a2af8e..8d75b6d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='aiopika_macrobase', - version='2.3.2', + version='2.4.0', packages=find_packages(), url='https://github.com/mbcores/aiopika-macrobase', license='MIT', @@ -14,7 +14,7 @@ 'aio-pika==5.5.3', 'uvloop==0.14.0', 'python-rapidjson==0.8.0', - 'structlog==19.2.0', + 'structlog>=19.2.0,<21.0.0', 'sentry-sdk>=0.14.3', 'aiocontextvars==0.2.2' ]