feat: add cluster name to leaf monitoring data#7981
feat: add cluster name to leaf monitoring data#7981joeriddles wants to merge 1 commit intonats-io:mainfrom
Conversation
Signed-off-by: Joe Riddle <joe@synadia.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cf7b6d1fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| lni := &LeafInfo{ | ||
| ID: ln.cid, | ||
| Name: ln.leaf.remoteServer, | ||
| Cluster: ln.leaf.remoteCluster, |
There was a problem hiding this comment.
Hide synthetic leaf cluster names from /leafz
When a remote leaf has leafnodes.remotes and a server_name but no cluster block, Server.New intentionally fabricates opts.Cluster.Name = opts.ServerName only for internal bookkeeping (server/server.go:820-825), and /varz already strips that back out (server/monitor.go:1708-1711). leafNodeResumeConnectProcess still sends this synthetic value in the leaf CONNECT (server/leafnode.go:3367-3375, server/leafnode.go:976-978), so exposing ln.leaf.remoteCluster here makes /leafz report standalone leaves as if they belonged to a real cluster named after the server. Any topology consumer using /leafz will misclassify non-clustered leaves whenever server_name is configured.
Useful? React with 👍 / 👎.
|
@wallyqs thanks for the review. I didn't mean to close this PR. Re-opened it. |
Add cluster name to leaf monitoring data.
This would be useful for downstream consumers of monitoring data and topology visualizations.
Signed-off-by: Joe Riddle joe@synadia.com
Tested locally with the following configs:
❯ curl -s http://127.0.0.1:8222/leafz | jq .leafs [ { "id": 5, "name": "leaf1", + "cluster": "leaf-cluster", "is_spoke": false, "account": "$G", "ip": "127.0.0.1", "port": 51218, "rtt": "154µs", "in_msgs": 0, "out_msgs": 0, "in_bytes": 0, "out_bytes": 0, "subscriptions": 5, "compression": "s2_uncompressed" } ]