Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DriverInfo to MongoClient creation #165

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alexbevi
Copy link

@alexbevi alexbevi commented Jun 3, 2024

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 Flask-PyMongo.

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|Flask-PyMongo","version":"3.11.4|2.3.1"},"os":{"type":"Darwin","name":"Darwin","architecture":"x86_64","version":"14.5"},"platform":"CPython 3.10.3.final.0"}}}


from flask_pymongo.helpers import BSONObjectIdConverter, JSONEncoder
from flask_pymongo.wrappers import MongoClient
from flask_pymongo._version import __version__
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. Pushed a fix to reorder these.

@alexbevi
Copy link
Author

@dcrosta would it be possible to get this PR reviewed?

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