[Django] #36836: Add version identification to Redis cache backend

2 views
Skip to first unread message

Django

unread,
8:17 AM (6 hours ago) 8:17 AM
to django-...@googlegroups.com
#36836: Add version identification to Redis cache backend
---------------------------+-----------------------------------------------
Reporter: vchomakov | Type: New feature
Status: new | Component: Core (Cache system)
Version: dev | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------+-----------------------------------------------
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)
--
Ticket URL: <https://code.djangoproject.com/ticket/36836>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
8:49 AM (5 hours ago) 8:49 AM
to django-...@googlegroups.com
#36836: Add version identification to Redis cache backend
-------------------------------------+-------------------------------------
Reporter: vchomakov | Owner: (none)
Type: New feature | Status: new
Component: Core (Cache system) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Ahmed Asar):

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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36836#comment:1>

Django

unread,
9:41 AM (4 hours ago) 9:41 AM
to django-...@googlegroups.com
#36836: Add version identification to Redis cache backend
-------------------------------------+-------------------------------------
Reporter: Vasil Chomakov | Owner: (none)
Type: New feature | Status: new
Component: Core (Cache system) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Vasil Chomakov):

* has_patch: 0 => 1

Comment:

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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36836#comment:2>

Django

unread,
10:10 AM (4 hours ago) 10:10 AM
to django-...@googlegroups.com
#36836: Add version identification to Redis cache backend
-------------------------------------+-------------------------------------
Reporter: Vasil Chomakov | Owner: (none)
Type: New feature | Status: closed
Component: Core (Cache system) | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* resolution: => wontfix
* status: new => closed

Comment:

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 [https://redis.io/docs/latest/commands/client-setinfo/ Redis docs]

> `lib-name` - meant to hold the name of the client library that's in use.

{{{#!python
(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`
[https://github.com/redis/redis-
py/blob/796428825dd33459b63228d274becc1c217589d1/redis/client.py#L294-L297
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
[https://docs.djangoproject.com/en/6.0/internals/contributing/bugs-and-
features/#requesting-features this should be proposed and discussed first
per the documented process].
--
Ticket URL: <https://code.djangoproject.com/ticket/36836#comment:3>
Reply all
Reply to author
Forward
0 new messages