Skip to content

Commit

Permalink
Align thread pool info to thread pool configuration (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
russcam authored and Mpdreamz committed Jun 21, 2019
1 parent 42803e0 commit eee8bf8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Nest/Cat/CatThreadPool/CatThreadPoolRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class CatThreadPoolRecord : ICatRecord
/// The number of active threads in the current thread pool
/// </summary>
[DataMember(Name = "active")]
[JsonFormatter(typeof(StringLongFormatter))]
public long Active { get; set; }
[JsonFormatter(typeof(StringIntFormatter))]
public int Active { get; set; }

/// <summary>
/// The number of tasks completed by the thread pool executor
Expand Down Expand Up @@ -108,8 +108,8 @@ public class CatThreadPoolRecord : ICatRecord
/// The number of tasks in the queue for the current thread pool
/// </summary>
[DataMember(Name = "queue")]
[JsonFormatter(typeof(StringLongFormatter))]
public long Queue { get; set; }
[JsonFormatter(typeof(StringIntFormatter))]
public int Queue { get; set; }

/// <summary>
/// The maximum number of tasks permitted in the queue for the current thread pool
Expand Down
25 changes: 23 additions & 2 deletions src/Nest/Cluster/NodesInfo/NodeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,39 @@ public class NodeInfoJvmMemory
[DataContract]
public class NodeThreadPoolInfo
{
/// <summary>
/// The configured keep alive time for threads
/// </summary>
[DataMember(Name = "keep_alive")]
public string KeepAlive { get; internal set; }

/// <summary>
/// The configured maximum number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "max")]
public int? Max { get; internal set; }

[DataMember(Name = "min")]
public int? Min { get; internal set; }
/// <summary>
/// The configured core number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "core")]
public int? Core { get; internal set; }

/// <summary>
/// The configured fixed number of active threads allowed in the current thread pool
/// </summary>
[DataMember(Name = "size")]
public int? Size { get; internal set; }

/// <summary>
/// The maximum number of tasks permitted in the queue for the current thread pool
/// </summary>
[DataMember(Name = "queue_size")]
public int? QueueSize { get; internal set; }

/// <summary>
/// The type of thread pool
/// </summary>
[DataMember(Name = "type")]
public string Type { get; internal set; }
}
Expand Down
4 changes: 4 additions & 0 deletions src/Tests/Tests/Cluster/NodesInfo/NodesInfoApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ protected void Assert(IReadOnlyDictionary<string, NodeThreadPoolInfo> 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)
Expand Down

0 comments on commit eee8bf8

Please sign in to comment.