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

Add pretty names (and other properties) to the cluster stats response. #3766

Merged
merged 4 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class ClusterNodesStats
[JsonProperty("jvm")]
public ClusterJvm Jvm { get; internal set; }

[JsonProperty("network_types")]
public ClusterNetworkTypes NetworkTypes { get; internal set; }

[JsonProperty("os")]
public ClusterOperatingSystemStats OperatingSystem { get; internal set; }

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

[JsonObject]
public class ClusterNetworkTypes
{
[JsonProperty("http_types")]
public IReadOnlyDictionary<string, int> HttpTypes { get; internal set; }

[JsonProperty("transport_types")]
public IReadOnlyDictionary<string, int> TransportTypes { get; internal set; }
}

[JsonObject]
public class ClusterFileSystem
{
Expand Down Expand Up @@ -143,8 +156,33 @@ public class ClusterOperatingSystemStats
[JsonProperty("available_processors")]
public int AvailableProcessors { get; internal set; }

[JsonProperty("mem")]
public OperatingSystemMemoryInfo Memory { get; internal set; }

[JsonProperty("names")]
public IReadOnlyCollection<ClusterOperatingSystemName> Names { get; internal set; }

[JsonProperty("pretty_names")]
public IReadOnlyCollection<ClusterOperatingSystemPrettyNane> PrettyNames { get; internal set; }
}

[JsonObject]
public class OperatingSystemMemoryInfo
{
[JsonProperty("free_in_bytes")]
public long FreeBytes { get; internal set; }

[JsonProperty("free_percent")]
public int FreePercent { get; internal set; }

[JsonProperty("total_in_bytes")]
public long TotalBytes { get; internal set; }

[JsonProperty("used_in_bytes")]
public long UsedBytes { get; internal set; }

[JsonProperty("used_percent")]
public int UsedPercent { get; internal set; }
}

[JsonObject]
Expand Down
5 changes: 5 additions & 0 deletions src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public interface IClusterStatsResponse : INodesResponse
[JsonProperty("cluster_name")]
string ClusterName { get; }

[JsonProperty("cluster_uuid")]
string ClusterUUID { get; }

[JsonProperty("indices")]
ClusterIndicesStats Indices { get; }

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

public string ClusterUUID { get; internal set; }

public ClusterIndicesStats Indices { get; internal set; }

public ClusterNodesStats Nodes { get; internal set; }
Expand Down
13 changes: 13 additions & 0 deletions src/Nest/Cluster/NodesInfo/NodeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class NodeOperatingSystemInfo
[JsonProperty("name")]
public string Name { get; internal set; }

[JsonProperty("pretty_name")]
public string PrettyName { get; internal set; }

[JsonProperty("refresh_interval_in_millis")]
public int RefreshInterval { get; internal set; }

Expand All @@ -91,6 +94,16 @@ public class NodeOperatingSystemInfo
public string Version { get; internal set; }
}

[JsonObject]
public class ClusterOperatingSystemPrettyNane
{
[JsonProperty("pretty_name")]
public string PrettyName { get; internal set; }

[JsonProperty("count")]
public int Count { get; internal set; }
}

[JsonObject]
public class NodeInfoOSCPU
{
Expand Down
9 changes: 9 additions & 0 deletions src/Nest/CommonOptions/Stats/PluginStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class PluginStats
[JsonProperty("description")]
public string Description { get; set; }

[JsonProperty("elasticsearch_version")]
public string ElasticsearchVersion { get; set; }

[JsonProperty("isolated")]
public bool Isolated { get; set; }

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

[JsonProperty("java_version")]
public string JavaVersion { get; set; }

[JsonProperty("has_native_controller")]
public bool HasNativeController { get; set; }
codebrain marked this conversation as resolved.
Show resolved Hide resolved

[JsonProperty("version")]
public string Version { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions src/Nest/CommonOptions/Stats/SegmentsStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class SegmentsStats
[JsonProperty("index_writer_memory_in_bytes")]
public long IndexWriterMemoryInBytes { get; set; }

[JsonProperty("max_unsafe_auto_id_timestamp")]
public string MaximumUnsafeAutoIdTimestamp { get; set; }

[JsonProperty("memory")]
public string Memory { get; set; }

Expand Down
10 changes: 10 additions & 0 deletions src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ protected override LazyResponses ClientUsage() => Calls(
protected override void ExpectResponse(IClusterStatsResponse response)
{
response.ClusterName.Should().NotBeNullOrWhiteSpace();

if (base.Cluster.ClusterConfiguration.Version >= "6.8.0")
response.ClusterUUID.Should().NotBeNullOrWhiteSpace();

response.NodeStatistics.Should().NotBeNull();
response.Status.Should().NotBe(ClusterStatus.Red);
response.Timestamp.Should().BeGreaterThan(0);
Expand Down Expand Up @@ -67,6 +71,12 @@ protected void Assert(ClusterNodesStats nodes)

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

if (base.Cluster.ClusterConfiguration.Version >= "6.8.0")
{
nodes.OperatingSystem.Memory.Should().NotBeNull();
nodes.OperatingSystem.PrettyNames.Should().NotBeNull();
}

var plugins = nodes.Plugins;
plugins.Should().NotBeEmpty();

Expand Down