-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLIENT INFO filter #1776
base: unstable
Are you sure you want to change the base?
Add CLIENT INFO filter #1776
Conversation
@@ -3340,98 +3340,120 @@ int isClientConnIpV6(client *c) { | |||
return getClientPeerId(c)[0] == '['; | |||
} | |||
|
|||
sds getClientInfoAttribute(client *client, const char *attr, int hide_user_data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid these repetitive conditions but it seems C doesn't have a graceful way to handle it such as
attribute_map attribute_handlers[] = {
{"id", () => { return client->id }},
{"addr", () => { return getClientPeerId() }},
{"laddr", () => { return getClientSockname() }},
// Add other attributes...
};
I am open to getting any other suggestions if it doesn't look good
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1776 +/- ##
============================================
+ Coverage 71.10% 71.14% +0.04%
============================================
Files 123 123
Lines 65552 65615 +63
============================================
+ Hits 46610 46684 +74
+ Misses 18942 18931 -11
|
Signed-off-by: Seungmin Lee <[email protected]>
8ac4e20
to
4f9a180
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just discussed about this in our standup.
Some thought on this.
- Do we really need it?
- I found the regex in the tcl helper to do the job just fine.
- I think @madolson mentioned this, it might be more beneficial for
CLIENT LIST
rather thanCLIENT INFO
.CLIENT INFO
isn't that heavily used.
Would be good to hear others perspective as well.
If users don’t actively use CLIENT INFO and if this filter is primarily for testing purposes, I’m fine with closing it. |
sungming2 Worth checking whether this is beneficial for |
Issue: #1699
Problem
The CLIENT INFO command currently returns all client details, which can be excessive. This proposal suggests adding an optional parameter to request specific fields, reducing unnecessary output and improving usability.
CLIENT INFO output:
Proposal
Enhance CLIENT INFO command by adding an optional parameter to specify the fields users want to retrieve.
Example
1. Default behavior (no parameters) remains unchanged:
Output:
2. Retrieve specific fields:
Output:
3. Retrieve a single field (No parsing required):
Output: