Skip to content

[Backport master] Add architecture stats to cluster node stats #5369

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

Merged
merged 2 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ public class ClusterOperatingSystemStats

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

[DataMember(Name = "architectures")]
public IReadOnlyCollection<ArchitectureStats> Architectures { get; internal set; }
}

[DataContract]
Expand Down Expand Up @@ -255,4 +258,14 @@ public class ClusterProcessorStats
[DataMember(Name ="time_in_millis")]
public long TimeInMilliseconds { get; set; }
}

[DataContract]
public class ArchitectureStats
{
[DataMember(Name = "arch")]
public string Architecture { get; set; }

[DataMember(Name = "count")]
public int Count { get; set; }
}
}
8 changes: 8 additions & 0 deletions tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ protected void Assert(ClusterNodesStats nodes)
nodes.OperatingSystem.AvailableProcessors.Should().BeGreaterThan(0);
nodes.OperatingSystem.AllocatedProcessors.Should().BeGreaterThan(0);

if (Cluster.ClusterConfiguration.Version.InRange(">=7.12.0"))
{
nodes.OperatingSystem.Architectures.Should().NotBeNull();
nodes.OperatingSystem.Architectures.Count.Should().BeGreaterThan(0);
nodes.OperatingSystem.Architectures.First().Architecture.Should().NotBeNullOrEmpty();
nodes.OperatingSystem.Architectures.First().Count.Should().BeGreaterThan(0);
}

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

if (Cluster.ClusterConfiguration.Version >= "6.8.0")
Expand Down