From 45e0d2ac697cc83c9dfba8ca0ff08a65f1887a47 Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Fri, 21 Jun 2019 13:23:04 +1000 Subject: [PATCH] Align thread pool info to thread pool configuration Relates: https://github.com/elastic/elasticsearch/pull/29123 --- .../Cat/CatThreadPool/CatThreadPoolRecord.cs | 8 +++--- src/Nest/Cluster/NodesInfo/NodeInfo.cs | 25 +++++++++++++++++-- .../Cluster/NodesInfo/NodesInfoApiTests.cs | 4 +++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Nest/Cat/CatThreadPool/CatThreadPoolRecord.cs b/src/Nest/Cat/CatThreadPool/CatThreadPoolRecord.cs index 5374df2eda4..087aefb9dd2 100644 --- a/src/Nest/Cat/CatThreadPool/CatThreadPoolRecord.cs +++ b/src/Nest/Cat/CatThreadPool/CatThreadPoolRecord.cs @@ -10,8 +10,8 @@ public class CatThreadPoolRecord : ICatRecord /// The number of active threads in the current thread pool /// [DataMember(Name = "active")] - [JsonFormatter(typeof(StringLongFormatter))] - public long Active { get; set; } + [JsonFormatter(typeof(StringIntFormatter))] + public int Active { get; set; } /// /// The number of tasks completed by the thread pool executor @@ -108,8 +108,8 @@ public class CatThreadPoolRecord : ICatRecord /// The number of tasks in the queue for the current thread pool /// [DataMember(Name = "queue")] - [JsonFormatter(typeof(StringLongFormatter))] - public long Queue { get; set; } + [JsonFormatter(typeof(StringIntFormatter))] + public int Queue { get; set; } /// /// The maximum number of tasks permitted in the queue for the current thread pool diff --git a/src/Nest/Cluster/NodesInfo/NodeInfo.cs b/src/Nest/Cluster/NodesInfo/NodeInfo.cs index 528ee5115ee..76e4e9fc7be 100644 --- a/src/Nest/Cluster/NodesInfo/NodeInfo.cs +++ b/src/Nest/Cluster/NodesInfo/NodeInfo.cs @@ -222,18 +222,39 @@ public class NodeInfoJvmMemory [DataContract] public class NodeThreadPoolInfo { + /// + /// The configured keep alive time for threads + /// [DataMember(Name = "keep_alive")] public string KeepAlive { get; internal set; } + /// + /// The configured maximum number of active threads allowed in the current thread pool + /// [DataMember(Name = "max")] public int? Max { get; internal set; } - [DataMember(Name = "min")] - public int? Min { get; internal set; } + /// + /// The configured core number of active threads allowed in the current thread pool + /// + [DataMember(Name = "core")] + public int? Core { get; internal set; } + /// + /// The configured fixed number of active threads allowed in the current thread pool + /// + [DataMember(Name = "size")] + public int? Size { get; internal set; } + + /// + /// The maximum number of tasks permitted in the queue for the current thread pool + /// [DataMember(Name = "queue_size")] public int? QueueSize { get; internal set; } + /// + /// The type of thread pool + /// [DataMember(Name = "type")] public string Type { get; internal set; } } diff --git a/src/Tests/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs b/src/Tests/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs index 3ef84088cf7..c83efa9649d 100644 --- a/src/Tests/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs +++ b/src/Tests/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs @@ -118,6 +118,10 @@ protected void Assert(IReadOnlyDictionary pools) pool.KeepAlive.Should().NotBeNullOrWhiteSpace(); pool.Type.Should().Be("scaling"); pool.QueueSize.Should().BeGreaterOrEqualTo(-1); + + // both should have a value for a scaling pool + pool.Core.Should().HaveValue(); + pool.Max.Should().HaveValue(); } protected void Assert(NodeInfoTransport transport)