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

metric cluster_name for leaf node is not correct #5913

Closed
AnjeiKozhev opened this issue Sep 22, 2024 · 0 comments · Fixed by #5931
Closed

metric cluster_name for leaf node is not correct #5913

AnjeiKozhev opened this issue Sep 22, 2024 · 0 comments · Fixed by #5931
Labels
defect Suspected defect such as a bug or regression

Comments

@AnjeiKozhev
Copy link

Observed behavior

Endpoint for leaf node metrics, in my case curl http://127.0.0.1:5888/varz returns the value of the cluster_name metric, which does not correspond to the name of the cluster to which this leaf node is connected, but coincides with the value of the server_name metric.

# curl http://127.0.0.1:5888/varz
{
  "server_id": "***********************************************",
  "server_name": "sandbox-v3",
  "version": "2.10.18",
  "proto": 1,
  "git_commit": "57d23ac",
  "go": "go1.22.5",
  "host": "localhost",
  "port": 5222,
  "auth_required": true,
  "max_connections": 65536,
  "ping_interval": 120000000000,
  "ping_max": 2,
  "http_host": "localhost",
  "http_port": 5888,
  "http_base_path": "",
  "https_port": 0,
  "auth_timeout": 2,
  "max_control_line": 4096,
  "max_payload": 1048576,
  "max_pending": 67108864,
  "cluster": {
     "name": "sandbox-v3"
  },
  "gateway": {},
  "leaf": {
    "remotes": [
      {
        "local_account": "************************************************************",
        "urls": [
          "sandbox-nats-vm01.****************:7422",
          "sandbox-nats-vm02.****************:7422",
          "sandbox-nats-vm03.****************:7422"
        ]
      },
      {
        "local_account": "*************************************************************",
        "urls": [
          "sandbox-nats-vm01:7422",
          "sandbox-nats-vm02:7422",
          "sandbox-nats-vm03:7422"
        ]
      }
    ]
  },

At the same time, the same metric from the server node returns the value of the cluster_name with the actual value of the cluster name specified in the configuration file:

# curl http://sandbox-nats-vm01.**************:4888/varz
{
  "server_id": "***********************************************",
  "server_name": "node-01",
  "version": "2.10.18",
  "proto": 1,
  "git_commit": "57d23ac",
  "go": "go1.22.5",
  "host": "sandbox-nats-vm01.**************",
  "port": 4222,
  "auth_required": true,
  "connect_urls": [
    "sandbox-nats-vm01.**************:4222",
    "sandbox-nats-vm02.**************:4222",
    "sandbox-nats-vm03.**************:4222"
  ],
  "max_connections": 65536,
  "ping_interval": 120000000000,
  "ping_max": 2,
  "http_host": "sandbox-nats-vm01.*****************",
  "http_port": 4888,
  "http_base_path": "",
  "https_port": 0,
  "auth_timeout": 2,
  "max_control_line": 4096,
  "max_payload": 2097152,
  "max_pending": 67108864,
  "cluster": {
    "name": "sandbox-nats-cluster",
    "addr": "sandbox-nats-vm01.******************",
    "cluster_port": 6222,
    "auth_timeout": 2,
    "urls": [
      "sandbox-nats-vm01.***************:6222",
      "sandbox-nats-vm02***************:6222",
      "sandbox-nats-vm03.***************:6222"
    ],
    "tls_timeout": 2,
    "pool_size": 3
  },

The mismatch of the values ​​of the cluster_node metric for the modes of the leaf node and the server node makes it impossible to use this metric in monitoring for all types of nodes simultaneously.

Expected behavior

If this is possible, then I would like to receive the current value of the cluster_name metric, corresponding to the cluster name for further identification of all nodes, one way or another participating in the work of this cluster

Server and client version

nats-server -v

nats-server: v2.10.18

nats --version

0.0.35

Host environment

Cluster. 3 nodes of:
Debian GNU/Linux 11 (bullseye)
AMD Ryzen 7 7700 8-Core Processor (family: 0x19, model: 0x61, stepping: 0x2)
64Gb RAM

Client:
Debian GNU/Linux 11 (bullseye)
AMD Ryzen 9 3900 12-Core Processor
128Gb RAM

Steps to reproduce

No response

@AnjeiKozhev AnjeiKozhev added the defect Suspected defect such as a bug or regression label Sep 22, 2024
derekcollison added a commit that referenced this issue Sep 26, 2024
…defined (#5931)

In situation where a Leaf server has no cluster specified, we internally
use the server name as the cluster name. We may need it in the protocol
so that the hub can suppress some messages to avoid duplicates.

We were however still reporting a cluster name in `/varz` and in the
banner on startup. This PR fixes both.

Resolves #5913

Signed-off-by: Ivan Kozlovic [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant