Skip to content

Commit f23e39d

Browse files
committed
Revised node roles aggregate and remove OS mem for cluster stats
Add node roles to node stats Closes #2011
1 parent ed91524 commit f23e39d

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public class ClusterNodesStats
2323

2424
[JsonProperty("fs")]
2525
public ClusterFileSystem FileSystem { get; internal set; }
26-
26+
2727
[JsonProperty("plugins")]
28-
public List<PluginStats> Plugins { get; internal set; }
28+
public List<PluginStats> Plugins { get; internal set; }
2929
}
3030

3131
[JsonObject]
@@ -80,7 +80,7 @@ public class ClusterJvmVersion
8080
public string VmVendor { get; internal set; }
8181

8282
[JsonProperty("count")]
83-
public int Count { get; internal set; }
83+
public int Count { get; internal set; }
8484
}
8585

8686
[JsonObject]
@@ -135,22 +135,13 @@ public class ClusterOperatingSystemStats
135135
[JsonProperty("available_processors")]
136136
public int AvailableProcessors { get; internal set; }
137137

138-
[JsonProperty("mem")]
139-
public ClusterOperatingSystemMemory Memory { get; internal set; }
138+
[JsonProperty("allocated_processors")]
139+
public int AllocatedProcessors { get; internal set; }
140140

141141
[JsonProperty("names")]
142142
public List<ClusterOperatingSystemName> Names { get; internal set; }
143143
}
144144

145-
[JsonObject]
146-
public class ClusterOperatingSystemMemory
147-
{
148-
[JsonProperty("total")]
149-
public string Total { get; internal set; }
150-
[JsonProperty("total_in_bytes")]
151-
public long TotalInBytes { get; internal set; }
152-
}
153-
154145
[JsonObject]
155146
public class ClusterOperatingSystemName
156147
{
@@ -167,16 +158,16 @@ public class ClusterNodeCount
167158
[JsonProperty("total")]
168159
public int Total { get; internal set; }
169160

170-
[JsonProperty("master_only")]
171-
public int MasterOnly { get; internal set; }
161+
[JsonProperty("coordinating_only")]
162+
public int CoordinatingOnly { get; internal set; }
172163

173-
[JsonProperty("data_only")]
174-
public int DataOnly { get; internal set; }
164+
[JsonProperty("master")]
165+
public int Master { get; internal set; }
175166

176-
[JsonProperty("master_data")]
177-
public int MasterData { get; internal set; }
167+
[JsonProperty("data")]
168+
public int Data { get; internal set; }
178169

179-
[JsonProperty("client")]
180-
public int Client { get; internal set; }
170+
[JsonProperty("ingest")]
171+
public int Ingest { get; internal set; }
181172
}
182173
}

src/Nest/Cluster/NodesInfo/NodeInfo.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ public class NodeInfo
2828
[JsonProperty(PropertyName = "http_address")]
2929
public string HttpAddress { get; internal set; }
3030

31+
/// <summary>
32+
/// All of the different roles that the node fulfills. An empty
33+
/// collection means that the node is a coordinating only node.
34+
/// </summary>
35+
[JsonProperty("roles")]
36+
public List<NodeRole> Roles { get; internal set; }
37+
3138
[JsonProperty(PropertyName = "settings")]
3239
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
3340
public DynamicResponse Settings { get; internal set; }
@@ -56,9 +63,6 @@ public class NodeInfo
5663

5764
[JsonProperty("plugins")]
5865
public List<PluginStats> Plugins { get; internal set; }
59-
60-
[JsonProperty("roles")]
61-
public List<NodeRole> Roles { get; internal set; }
6266
}
6367

6468
[JsonObject]

src/Nest/Cluster/NodesStats/NodeStats.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ public class NodeStats
2121
[JsonProperty("ip")]
2222
public IEnumerable<string> Ip { get; internal set; }
2323

24+
/// <summary>
25+
/// All of the different roles that the node fulfills. An empty
26+
/// collection means that the node is a coordinating only node.
27+
/// </summary>
28+
[JsonProperty("roles")]
29+
public IEnumerable<NodeRole> Roles { get; internal set; }
30+
2431
[JsonProperty("indices")]
2532
public IndexStats Indices { get; internal set; }
2633

src/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected void Assert(ClusterNodesStats nodes)
3737
{
3838
nodes.Should().NotBeNull();
3939
nodes.Count.Should().NotBeNull();
40-
nodes.Count.MasterData.Should().BeGreaterOrEqualTo(1);
40+
nodes.Count.Master.Should().BeGreaterOrEqualTo(1);
4141

4242
nodes.FileSystem.Should().NotBeNull();
4343
nodes.FileSystem.AvailableInBytes.Should().BeGreaterThan(0);
@@ -61,7 +61,7 @@ protected void Assert(ClusterNodesStats nodes)
6161

6262
nodes.OperatingSystem.Should().NotBeNull();
6363
nodes.OperatingSystem.AvailableProcessors.Should().BeGreaterThan(0);
64-
nodes.OperatingSystem.Memory.Should().NotBeNull();
64+
nodes.OperatingSystem.AllocatedProcessors.Should().BeGreaterThan(0);
6565

6666
nodes.OperatingSystem.Names.Should().NotBeEmpty();
6767

src/Tests/Cluster/NodesStats/NodesStatsApiTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ protected void Assert(NodeStats node)
5252
node.TransportAddress.Should().NotBeNullOrWhiteSpace();
5353
node.Host.Should().NotBeNullOrWhiteSpace();
5454
node.Ip.Should().NotBeEmpty();
55+
node.Roles.Should().NotBeNullOrEmpty();
5556
}
5657

5758
protected void Assert(IndexStats index)

0 commit comments

Comments
 (0)