Add Flask-Session version identification to Redis backends #283
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-Session, 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-Session) rather than redis-py itself.Implementation
get_flask_session_version()utility function to retrieve the Flask-Session version usingimportlib.metadatawith fallback to__version__get_redis_py_version()utility function to retrieve the redis-py versionadd_redis_version_info()utility function to setlib_name="redis-py(flask-session_v<version>)"andlib_version=<redis-py-version>RedisSessionInterface.__init__()to calladd_redis_version_info()ReadTheDocs Configuration Fix
This PR also fixes the missing Sphinx configuration in
.readthedocs.yamlthat was causing all documentation builds to fail:configuration: docs/conf.pyto thesphinxsectionTesting
tests/test_redis.pyto verify version identification behaviorlib_nameandlib_versionvalues are respected and not overriddenChecklist: