From 92509d3e37cc6b5f857e255e861854f0006223c0 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 4 Oct 2017 10:47:03 +0200 Subject: [PATCH] SONAR-9802 add hostname to ES nodes in clustered System Info --- .../platform/monitoring/cluster/SearchNodesInfoLoaderImpl.java | 1 + .../monitoring/cluster/SearchNodesInfoLoaderImplTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImpl.java index 08703a608b3..9ed9b9f7d1d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImpl.java @@ -54,6 +54,7 @@ public class SearchNodesInfoLoaderImpl implements SearchNodesInfoLoader { private static NodeInfo toNodeInfo(NodeStats stat) { String nodeName = stat.getNode().getName(); NodeInfo info = new NodeInfo(nodeName); + info.setHost(stat.getHostname()); ProtobufSystemInfo.Section.Builder section = ProtobufSystemInfo.Section.newBuilder(); section.setName("Search State"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImplTest.java index ebb96e3f6ba..0f3caf947e4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/cluster/SearchNodesInfoLoaderImplTest.java @@ -42,6 +42,7 @@ public class SearchNodesInfoLoaderImplTest { assertThat(nodes).hasSize(1); NodeInfo node = nodes.iterator().next(); assertThat(node.getName()).isNotEmpty(); + assertThat(node.getHost()).isNotEmpty(); assertThat(node.getSections()).hasSize(1); ProtobufSystemInfo.Section stateSection = node.getSections().get(0); -- 2.39.5