Skip to content
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

Get the node address of an executed command in cluster mode #624

Open
longxice opened this issue Aug 29, 2024 · 4 comments
Open

Get the node address of an executed command in cluster mode #624

longxice opened this issue Aug 29, 2024 · 4 comments
Labels

Comments

@longxice
Copy link

longxice commented Aug 29, 2024

Hi all,

I would like to use the node address for metrics. That helps to identify which commands are sent to a node in the cluster.
However, I don't sure the way to get it.

I intend to get the node address of the executed command as follows:
Step 1: Get the key slot by calling cmd.Slot().
Step 2: Use reflection to call clusterClient._pick(...).

However, after executing the command, there may be a hash slot change caused by Redis failover.

Could you point out the correct way?

@rueian
Copy link
Collaborator

rueian commented Aug 30, 2024

Hi @longxice,

Unfortunately, getting the exact address is impossible currently. Unless we expend the CommandSlice
struct

type CommandSlice struct {
s []string
l int32
r int32
}
and inject destination into the it from here

rueidis/mux.go

Line 54 in 9a347d7

dst string

@rueian
Copy link
Collaborator

rueian commented Aug 30, 2024

But we also need to consider if there is a notable performance impact due to the changes.

@rueian rueian added the feature label Aug 30, 2024
@longxice
Copy link
Author

longxice commented Sep 9, 2024

Hi @rueian

Thank you for your response.

I hope this feature will be released soon.

Thank you.

@rueian
Copy link
Collaborator

rueian commented Sep 11, 2024

Yes, but we don’t have an ETA for this. This could have great impact in terms of performance. I currently have no idea how big it could be.

Also this may related ro #454.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants