Skip to content

Add support for DriverInfo in MongoClient#712

Open
alexbevi wants to merge 1 commit intodoableware:masterfrom
alexbevi:patch-1
Open

Add support for DriverInfo in MongoClient#712
alexbevi wants to merge 1 commit intodoableware:masterfrom
alexbevi:patch-1

Conversation

@alexbevi
Copy link
Copy Markdown

This PR will wrap the MongoClient creation with pymongo.driver_info.DriverInfo which makes it easier to filter mongod logs for connections that originate from djongo.

For example:

{"t":{"$date":"2024-06-03T16:10:26.686-04:00"},"s":"I","c":"NETWORK","id":51800,"ctx":"conn225","msg":"client metadata","attr":{"remote":"127.0.0.1:61857","client":"conn225","negotiatedCompressors":[],"doc":{"driver":{"name":"PyMongo|djongo","version":"3.11.4|1.3.7"},"os":{"type":"Darwin","name":"Darwin","architecture":"x86_64","version":"14.5"},"platform":"CPython 3.10.3.final.0"}}}

Added conditional import for DriverInfo from PyMongo.
@bisht2050
Copy link
Copy Markdown

@nesdis Can you please help review/merge this? I am debugging an issue where I have multiple Python clients connecting to my MongoDB server and I can't figure out the logs from the Djongo app. It's very painful to find out correct logs currently. This enhancement would be very much useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants