-
Notifications
You must be signed in to change notification settings - Fork 876
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
include user info in redis_connected_clients_details #776
Conversation
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.
Thanks for the PR!
Looking good - left two comments.
exporter/clients.go
Outdated
@@ -16,7 +16,7 @@ import ( | |||
id=11 addr=127.0.0.1:63508 fd=8 name= age=6321 idle=6320 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=setex | |||
id=14 addr=127.0.0.1:64958 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client | |||
*/ | |||
func parseClientListString(clientInfo string) ([]string, bool) { | |||
func parseClientListString(clientInfo string) (map[string]string, bool) { |
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 like that you're making this a bit more explicit and not use the array any longer but while you're changing this, maybe turn this into a ClientInfo
struct.
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.
Also, I don't see where you're extracting "user"
- I think that's missing.
White you're at it, want to add resp
as well?
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.
-
There is now a ClientInfo struct.
-
"user" field is extracted as the rest of the fields during the
range strings.Split(clientInfo, " ")
The clientinfo string is like id=4 addr=127.0.0.1:50000 laddr=127.0.0.1:6379 fd=8 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=40928 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 events=r cmd=client user=default redir=-1
from a redis>6 server
- Sorry, but I do not understand the resp part
Please let me know anything, thanks for the feedback !
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.
Oh, the documentation here says resp: client RESP protocol version. Added in Redis 7.0
Check the tests: They're failing: I think in the tests you can just replace |
exporter/clients.go
Outdated
@@ -16,7 +16,7 @@ import ( | |||
id=11 addr=127.0.0.1:63508 fd=8 name= age=6321 idle=6320 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=setex | |||
id=14 addr=127.0.0.1:64958 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client | |||
*/ | |||
func parseClientListString(clientInfo string) ([]string, bool) { | |||
func parseClientListString(clientInfo string) (map[string]string, bool) { |
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.
Oh, the documentation here says resp: client RESP protocol version. Added in Redis 7.0
Have a look at the tests, there are still errors:
|
Pull Request Test Coverage Report for Build 85
💛 - Coveralls |
I think everything should be OK by now. I had some problems running the tests. Any feedback is really welcome, thanks ! |
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.
🚀
Related to issue #775, redis_connected_clients_details don't show user info.
This is still a WIP as there are no test yet. But it tries to follow comment
Please let me know if this approach and code changes are likely to be merged, and I will finish it. Otherwise feel free to reject it.
parseClientListString now returns a map containing the parsed output of the client list reply
extractConnectedClientMetrics now creates the metric description. Instead during startup at exporter.go
Maybe this is not somehow very efficient as they are created at every scrape.