Opened 5 hours ago
Last modified 5 hours ago
#36879 new New feature
Add Django cache identification to Redis client metadata — at Initial Version
| Reported by: | Vasil Chomakov | Owned by: | |
|---|---|---|---|
| Component: | Core (Cache system) | Version: | dev |
| Severity: | Normal | Keywords: | redis cache observability |
| Cc: | Vasil Chomakov | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Proposal: Add Django cache identification to Redis client metadata
Context
Redis documentation recommends that clients identify themselves via connection metadata to help operators monitor, debug, and reason about production systems (for example using CLIENT SETINFO / CLIENT INFO):
https://redis.io/docs/latest/commands/client-setinfo/
This information is intended to help Redis operators understand what software is connecting to their servers, especially in shared or multi-tenant environments.
Django’s Redis cache backend is built on top of redis-py, which means Redis connections created by Django are currently indistinguishable from other redis-py-based clients in shared Redis deployments. This makes it harder for Redis operators to attribute traffic, diagnose issues, or understand cache usage patterns when multiple applications or frameworks share the same Redis instance.
Proposal
Django could provide additional, non-invasive client identification for Redis cache connections to indicate that the connection originates from Django’s cache framework.
redis-py exposes a driver_info API that may be used to attach Django-specific context to the connection, in line with Redis’s client identification recommendations.
Goals
- Align with Redis client identification best practices
- Allow Redis operators to distinguish Django cache connections
- Improve observability in shared Redis environments
Example (illustrative)
A Redis connection created by Django’s cache backend might expose metadata equivalent to:
- Client library:
redis-py - Framework / driver:
django-cache
Scope
- This is a feature proposal, not a patch submission
- No behavioral changes to caching semantics are proposed
- Any implementation would rely solely on
redis-py’s supported APIs