Skip to content

Commit e1343ca

Browse files
authored
Add pretty names (and other properties) to the cluster stats response. (#3766)
1 parent caa2dd7 commit e1343ca

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed

src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public class ClusterNodesStats
1515
[JsonProperty("jvm")]
1616
public ClusterJvm Jvm { get; internal set; }
1717

18+
[JsonProperty("network_types")]
19+
public ClusterNetworkTypes NetworkTypes { get; internal set; }
20+
1821
[JsonProperty("os")]
1922
public ClusterOperatingSystemStats OperatingSystem { get; internal set; }
2023

@@ -28,6 +31,16 @@ public class ClusterNodesStats
2831
public IReadOnlyCollection<string> Versions { get; internal set; }
2932
}
3033

34+
[JsonObject]
35+
public class ClusterNetworkTypes
36+
{
37+
[JsonProperty("http_types")]
38+
public IReadOnlyDictionary<string, int> HttpTypes { get; internal set; }
39+
40+
[JsonProperty("transport_types")]
41+
public IReadOnlyDictionary<string, int> TransportTypes { get; internal set; }
42+
}
43+
3144
[JsonObject]
3245
public class ClusterFileSystem
3346
{
@@ -143,8 +156,33 @@ public class ClusterOperatingSystemStats
143156
[JsonProperty("available_processors")]
144157
public int AvailableProcessors { get; internal set; }
145158

159+
[JsonProperty("mem")]
160+
public OperatingSystemMemoryInfo Memory { get; internal set; }
161+
146162
[JsonProperty("names")]
147163
public IReadOnlyCollection<ClusterOperatingSystemName> Names { get; internal set; }
164+
165+
[JsonProperty("pretty_names")]
166+
public IReadOnlyCollection<ClusterOperatingSystemPrettyNane> PrettyNames { get; internal set; }
167+
}
168+
169+
[JsonObject]
170+
public class OperatingSystemMemoryInfo
171+
{
172+
[JsonProperty("free_in_bytes")]
173+
public long FreeBytes { get; internal set; }
174+
175+
[JsonProperty("free_percent")]
176+
public int FreePercent { get; internal set; }
177+
178+
[JsonProperty("total_in_bytes")]
179+
public long TotalBytes { get; internal set; }
180+
181+
[JsonProperty("used_in_bytes")]
182+
public long UsedBytes { get; internal set; }
183+
184+
[JsonProperty("used_percent")]
185+
public int UsedPercent { get; internal set; }
148186
}
149187

150188
[JsonObject]

src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public interface IClusterStatsResponse : INodesResponse
77
[JsonProperty("cluster_name")]
88
string ClusterName { get; }
99

10+
[JsonProperty("cluster_uuid")]
11+
string ClusterUUID { get; }
12+
1013
[JsonProperty("indices")]
1114
ClusterIndicesStats Indices { get; }
1215

@@ -24,6 +27,8 @@ public class ClusterStatsResponse : NodesResponseBase, IClusterStatsResponse
2427
{
2528
public string ClusterName { get; internal set; }
2629

30+
public string ClusterUUID { get; internal set; }
31+
2732
public ClusterIndicesStats Indices { get; internal set; }
2833

2934
public ClusterNodesStats Nodes { get; internal set; }

src/Nest/Cluster/NodesInfo/NodeInfo.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public class NodeOperatingSystemInfo
8181
[JsonProperty("name")]
8282
public string Name { get; internal set; }
8383

84+
[JsonProperty("pretty_name")]
85+
public string PrettyName { get; internal set; }
86+
8487
[JsonProperty("refresh_interval_in_millis")]
8588
public int RefreshInterval { get; internal set; }
8689

@@ -91,6 +94,16 @@ public class NodeOperatingSystemInfo
9194
public string Version { get; internal set; }
9295
}
9396

97+
[JsonObject]
98+
public class ClusterOperatingSystemPrettyNane
99+
{
100+
[JsonProperty("pretty_name")]
101+
public string PrettyName { get; internal set; }
102+
103+
[JsonProperty("count")]
104+
public int Count { get; internal set; }
105+
}
106+
94107
[JsonObject]
95108
public class NodeInfoOSCPU
96109
{

src/Nest/CommonOptions/Stats/PluginStats.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ public class PluginStats
1111
[JsonProperty("description")]
1212
public string Description { get; set; }
1313

14+
[JsonProperty("elasticsearch_version")]
15+
public string ElasticsearchVersion { get; set; }
16+
1417
[JsonProperty("isolated")]
1518
public bool Isolated { get; set; }
1619

@@ -23,6 +26,12 @@ public class PluginStats
2326
[JsonProperty("site")]
2427
public bool Site { get; set; }
2528

29+
[JsonProperty("java_version")]
30+
public string JavaVersion { get; set; }
31+
32+
[JsonProperty("has_native_controller")]
33+
public bool? HasNativeController { get; set; }
34+
2635
[JsonProperty("version")]
2736
public string Version { get; set; }
2837
}

src/Nest/CommonOptions/Stats/SegmentsStats.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public class SegmentsStats
3232
[JsonProperty("index_writer_memory_in_bytes")]
3333
public long IndexWriterMemoryInBytes { get; set; }
3434

35+
[JsonProperty("max_unsafe_auto_id_timestamp")]
36+
public string MaximumUnsafeAutoIdTimestamp { get; set; }
37+
3538
[JsonProperty("memory")]
3639
public string Memory { get; set; }
3740

src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ protected override LazyResponses ClientUsage() => Calls(
2828
protected override void ExpectResponse(IClusterStatsResponse response)
2929
{
3030
response.ClusterName.Should().NotBeNullOrWhiteSpace();
31+
32+
if (base.Cluster.ClusterConfiguration.Version >= "6.8.0")
33+
response.ClusterUUID.Should().NotBeNullOrWhiteSpace();
34+
3135
response.NodeStatistics.Should().NotBeNull();
3236
response.Status.Should().NotBe(ClusterStatus.Red);
3337
response.Timestamp.Should().BeGreaterThan(0);
@@ -67,6 +71,12 @@ protected void Assert(ClusterNodesStats nodes)
6771

6872
nodes.OperatingSystem.Names.Should().NotBeEmpty();
6973

74+
if (base.Cluster.ClusterConfiguration.Version >= "6.8.0")
75+
{
76+
nodes.OperatingSystem.Memory.Should().NotBeNull();
77+
nodes.OperatingSystem.PrettyNames.Should().NotBeNull();
78+
}
79+
7080
var plugins = nodes.Plugins;
7181
plugins.Should().NotBeEmpty();
7282

0 commit comments

Comments
 (0)