Add DriverInfo class for upstream driver tracking#3880
Add DriverInfo class for upstream driver tracking#3880vchomakov merged 8 commits intoredis:masterfrom
Conversation
Didn't go through all the changes.
petyaslavova
left a comment
There was a problem hiding this comment.
I think we should unify driver metadata handling:
-
Store the redis-py client version in DriverInfo.
If a DriverInfo object is provided, ignore lib_name and lib_version - it should be clearly stated in the docstrings. -
Propagate DriverInfo through pools and connections.
Pools should hold a driver_info attribute and pass it down so each connection reads driver fields only from that object. -
Fallback behavior:
If no DriverInfo is provided, initialize one using the existing lib_name / lib_version. -
Deprecate lib_name and lib_version.
Mark them as deprecated now and plan to remove them after a few releases.(we have an annotation that can be used to deprecate concrete arguments)
This will keep the driver info consistent, will remove duplicated parameters, and simplify the API going forward.
Thanks, @petyaslavova, for the detailed suggestions. I've addressed them in the last commit. |
bobymicroby
left a comment
There was a problem hiding this comment.
@vchomakov LGTM, maybe consider adding a helper to do the fallback logic as I mentioned above.
Description of change
This PR adds a DriverInfo class to enable upstream drivers (like django-redis, celery, rq, etc.) to identify themselves when using redis-py as their underlying client.
Key features:
driver_infoparameterdriver_infois automatically propagated from client to connection pool to individual connectionslib_nameandlib_versionparameters are now deprecated in favor ofdriver_infodriver_infois not provided, it's created fromlib_name/lib_version(if present)Example usage:
Pull Request check-list
lib_name/lib_versionlib_nameandlib_versionparameters