Created
June 16, 2022 03:40
-
-
Save srinivasiyer/f728f2cce783c2667ebdc32c7d42b7b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tracer.wrap( | |
service=DatadogService.CHANNELS_DOCUMENTDB.value, | |
name=DatadogOperation.MONGO_QUERY.value, | |
span_type=DatadogSpanType.DATABASE.value, | |
resource="InboxesRepository.fetch_one", | |
) | |
async def fetch_one(self, *, inbox_id: int) -> Optional[InboxModel]: | |
span = tracer.current_span() | |
add_tag_to_span(span, "inbox_id", inbox_id) | |
try: | |
inbox_map = await self.__collection.find_one( | |
filter={InboxesField.ID.value: inbox_id} | |
) | |
inbox: Optional[InboxModel] = None | |
if inbox_map is not None: | |
inbox = InboxModel(**inbox_map) | |
return inbox | |
except Exception as e: | |
self.__log.error( | |
statement="FETCH_ONE_INBOX_DOC_FAILED", | |
description="Fetching Inbox by Id failed", | |
error=e, | |
search_terms={"inbox_id": str(inbox_id)}, | |
references={"collection": self.__COLLECTION}, | |
) | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment