Add Flask-Caching version identification to Redis backends #631
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds client identification to Redis connections created by Flask-Caching, allowing Redis operators to see which library is connecting to their servers.
Redis servers support the
lib_nameandlib_versionparameters (introduced in redis-py) to help operators identify which upstream libraries are connecting. This improves observability and debugging for Redis operators.Following redis-py best practices,
lib_nameandlib_versionidentify the upstream library (Flask-Caching) rather than redis-py itself.Implementation
get_flask_caching_version()utility function to retrieve the Flask-Caching version usingimportlib.metadatawith fallback to__version__add_redis_version_info()utility function to setlib_name="Flask-Caching"andlib_version=<version>RedisCache.factory(),RedisSentinelCache.factory(), andRedisClusterCache.factory()to calladd_redis_version_info()CI Workflow Fix
This PR also fixes the deprecated GitHub Actions versions that were causing all CI runs to fail:
actions/checkout@v2→v4actions/setup-python@v2→v5actions/cache@v2→v4These actions were deprecated by GitHub and enforcement started recently, causing all workflow runs (including scheduled jobs) to fail. This fix unblocks CI for this PR and all future contributions.
Testing
tests/test_backend_cache.pyto verify version identification behaviorChecklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.