-
Notifications
You must be signed in to change notification settings - Fork 7
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 Driver Info into the MongoClient #210
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a setting to let users disable telemetry? Should we disable telemetry during development of this library (i.e. running the Django test suite). Two things I've done in other backends: https://github.com/cockroachdb/django-cockroachdb/blob/00c9e2a13adb00a6f89d0eda725d675238e4611e/django_cockroachdb/base.py#L64-L67
django_mongodb/base.py
Outdated
return MongoClient(**conn_params, driver=self._driver_info()) | ||
|
||
def _driver_info(self): | ||
return DriverInfo("django-mongodb", metadata.version("django-mongodb")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than using importlib.metadata
you could use from . import __version__ as django_mongodb_version
(this is what I used in other libraries).
return MongoClient(**conn_params) | ||
return MongoClient(**conn_params, driver=self._driver_info()) | ||
|
||
def _driver_info(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be a separate method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but I like the separation is all.
That's a good idea. I'll add an env flag check. As a general FYI, In other repos we don't make it optional. |
No description provided.