#36836 closed New feature (wontfix)
Add version identification to Redis cache backend
| Reported by: | Vasil Chomakov | Owned by: | |
|---|---|---|---|
| Component: | Core (Cache system) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The Redis documentation recommends that clients identify themselves using the lib_name and lib_version connection parameters. This helps Redis operators monitor connections and debug issues in production environments.
See: https://redis.io/docs/latest/commands/client-setinfo/
Django's Redis cache backend should follow this recommendation by automatically setting these parameters when creating connection pools.
Proposed implementation:
- Set lib_name to 'redis-py(django_v{version})'
- Set lib_version to the redis-py version
- Only set these if not already provided by the user (backward compatible)
Change History (4)
comment:1 by , 3 weeks ago
comment:2 by , 3 weeks ago
| Has patch: | set |
|---|
PR created: https://github.com/django/django/pull/20476
This adds lib_name and lib_version parameters to Redis connections to identify Django clients, making it easier for Redis operators to monitor and debug production environments.
follow-up: 4 comment:3 by , 3 weeks ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Django only uses the redis package for providing a caching backend so it seems inapropriate to override the lib_name and lib_version that redis-py already sets by itself.
Per Redis docs
lib-name- meant to hold the name of the client library that's in use.
(Pdb) pp client.client_info() {... 'lib-name': 'redis-py', 'lib-ver': '7.1.0', ... }
Moreover it seems that redis.Connection(lib_name) and lib_info are deprecated so we'd want to use driver_info instead.
If we were to change change lib_name I think it should be along the lines of redis-py(django-cache) as these connections are only meant to be used for this purpose but just like each new feature this should be proposed and discussed first per the documented process.
comment:4 by , 2 weeks ago
Thanks, Simon, for the input.
Following the new feature proposal process you referenced, I don’t seem to have permission to add a new idea to the Django New Features project board here:
https://github.com/orgs/django/projects/24
Since the board doesn’t allow direct submissions, could you please confirm the correct way to propose this idea?
Should I open a new issue in this tracker as an appropriate place to continue that process?
Thanks for the guidance.
— Vasil
Replying to Simon Charette:
Django only uses the
redispackage for providing a caching backend so it seems inapropriate to override thelib_nameandlib_versionthatredis-pyalready sets by itself.
Per Redis docs
lib-name- meant to hold the name of the client library that's in use.
(Pdb) pp client.client_info() {... 'lib-name': 'redis-py', 'lib-ver': '7.1.0', ... }Moreover it seems that
redis.Connection(lib_name)andlib_infoare deprecated so we'd want to usedriver_infoinstead.
If we were to change change
lib_nameI think it should be along the lines ofredis-py(django-cache)as these connections are only meant to be used for this purpose but just like each new feature this should be proposed and discussed first per the documented process.
Hi,
I’d like to work on this ticket.
I’ll investigate how the Redis backend creates connections and propose a patch implementing CLIENT SETINFO with the suggested defaults, unless already provided by the user.
Please let me know if that sounds good.