feat: add Redis driver info for client identification#95
Open
vchomakov wants to merge 1 commit intopermitio:masterfrom
Open
feat: add Redis driver info for client identification#95vchomakov wants to merge 1 commit intopermitio:masterfrom
vchomakov wants to merge 1 commit intopermitio:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds support for redis-py's
DriverInfoclass to identify fastapi-websocket-pubsub as an upstream driver in Redis connection metadata, following the Redis client library identification guidance.This improves observability for Redis administrators by making fastapi-websocket-pubsub connections easily identifiable when inspecting connected clients (e.g., via
CLIENT LISTorCLIENT INFOcommands).Changes
_add_driver_info_to_broadcast()method toEventBroadcasterclassDriverInfoclass when available (modern redis-py)lib_name/lib_versionfor older redis-py versionstests/test_driver_info.pyMotivation
Redis recommends that client libraries identify themselves using
CLIENT SETINFOto help administrators understand which applications are connected. This change aligns fastapi-websocket-pubsub with this best practice by:lib-nameto identify fastapi-websocket-pubsub as the upstream driver (e.g.,redis-py(fastapi-websocket-pubsub_v0.3.9))lib-verto the redis-py client versionCompatibility
The implementation gracefully handles different redis-py versions:
DriverInfoclass (preferred method)lib_name/lib_versionfallbackTesting