Align cat thread pool info to thread pool config (#29195)
Today we report thread pool info using a common object. This means that we use a shared set of terminology that is not consistent with the terminology used to the configure thread pools. This holds in particular for the minimum and maximum number of threads in the thread pool where we use the following terminology: thread pool info | fixed | scaling min core size max max size A previous change addressed this for the nodes info API. This commit changes the display of thread pool info in the cat thread pool API too to be dependent on the type of the thread pool so that we can align the terminology in the output of thread pool info with the terminology used to configure a thread pool.
This commit is contained in:
parent
8e2f2be249
commit
8fdca6a89a
|
@ -113,14 +113,15 @@ in the table below.
|
|||
|Field Name |Alias |Description
|
||||
|`type` |`t` |The current (*) type of thread pool (`fixed` or `scaling`)
|
||||
|`active` |`a` |The number of active threads in the current thread pool
|
||||
|`size` |`s` |The number of threads in the current thread pool
|
||||
|`pool_size` |`psz` |The number of threads in the current thread pool
|
||||
|`queue` |`q` |The number of tasks in the queue for the current thread pool
|
||||
|`queue_size` |`qs` |The maximum number of tasks permitted in the queue for the current thread pool
|
||||
|`rejected` |`r` |The number of tasks rejected by the thread pool executor
|
||||
|`largest` |`l` |The highest number of active threads in the current thread pool
|
||||
|`completed` |`c` |The number of tasks completed by the thread pool executor
|
||||
|`min` |`mi` |The configured minimum number of active threads allowed in the current thread pool
|
||||
|`max` |`ma` |The configured maximum number of active threads allowed in the current thread pool
|
||||
|`core` |`cr` |The configured core number of active threads allowed in the current thread pool
|
||||
|`max` |`mx` |The configured maximum number of active threads allowed in the current thread pool
|
||||
|`size` |`sz` |The configured fixed number of active threads allowed in the current thread pool
|
||||
|`keep_alive` |`k` |The configured keep alive time for threads
|
||||
|=======================================================================
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
"Test cat thread_pool output":
|
||||
|
||||
- skip:
|
||||
version: " - 6.99.99"
|
||||
reason: this API was changed in a backwards-incompatible fashion in 7.0.0 so we need to skip in a mixed cluster
|
||||
|
||||
- do:
|
||||
cat.thread_pool: {}
|
||||
|
||||
|
@ -46,25 +50,25 @@
|
|||
- do:
|
||||
cat.thread_pool:
|
||||
thread_pool_patterns: bulk
|
||||
h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive
|
||||
h: id,name,type,active,pool_size,queue,queue_size,rejected,largest,completed,core,max,size,keep_alive
|
||||
v: true
|
||||
|
||||
- match:
|
||||
$body: |
|
||||
/^ id \s+ name \s+ type \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n
|
||||
(\S+ \s+ bulk \s+ fixed \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n)+ $/
|
||||
/^ id \s+ name \s+ type \s+ active \s+ pool_size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ core \s+ max \s+ size \s+ keep_alive \n
|
||||
(\S+ \s+ bulk \s+ fixed \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n)+ $/
|
||||
|
||||
- do:
|
||||
cat.thread_pool:
|
||||
thread_pool_patterns: fetch*
|
||||
h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive
|
||||
h: id,name,type,active,pool_size,queue,queue_size,rejected,largest,completed,core,max,size,keep_alive
|
||||
v: true
|
||||
|
||||
- match:
|
||||
$body: |
|
||||
/^ id \s+ name \s+ type \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n
|
||||
(\S+ \s+ fetch_shard_started \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n
|
||||
\S+ \s+ fetch_shard_store \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n)+ $/
|
||||
/^ id \s+ name \s+ type \s+ active \s+ pool_size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ core \s+ max \s+ size \s+ keep_alive \n
|
||||
(\S+ \s+ fetch_shard_started \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n
|
||||
\S+ \s+ fetch_shard_store \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n)+ $/
|
||||
|
||||
- do:
|
||||
cat.thread_pool:
|
||||
|
|
|
@ -124,14 +124,15 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
|||
table.addCell("name", "default:true;alias:n;desc:thread pool name");
|
||||
table.addCell("type", "alias:t;default:false;desc:thread pool type");
|
||||
table.addCell("active", "alias:a;default:true;text-align:right;desc:number of active threads");
|
||||
table.addCell("size", "alias:s;default:false;text-align:right;desc:number of threads");
|
||||
table.addCell("pool_size", "alias:psz;default:false;text-align:right;desc:number of threads");
|
||||
table.addCell("queue", "alias:q;default:true;text-align:right;desc:number of tasks currently in queue");
|
||||
table.addCell("queue_size", "alias:qs;default:false;text-align:right;desc:maximum number of tasks permitted in queue");
|
||||
table.addCell("rejected", "alias:r;default:true;text-align:right;desc:number of rejected tasks");
|
||||
table.addCell("largest", "alias:l;default:false;text-align:right;desc:highest number of seen active threads");
|
||||
table.addCell("completed", "alias:c;default:false;text-align:right;desc:number of completed tasks");
|
||||
table.addCell("min", "alias:mi;default:false;text-align:right;desc:minimum number of threads");
|
||||
table.addCell("max", "alias:ma;default:false;text-align:right;desc:maximum number of threads");
|
||||
table.addCell("core", "alias:cr;default:false;text-align:right;desc:core number of threads in a scaling thread pool");
|
||||
table.addCell("max", "alias:mx;default:false;text-align:right;desc:maximum number of threads in a scaling thread pool");
|
||||
table.addCell("size", "alias:sz;default:false;text-align:right;desc:number of threads in a fixed thread pool");
|
||||
table.addCell("keep_alive", "alias:ka;default:false;text-align:right;desc:thread keep alive time");
|
||||
table.endHeaders();
|
||||
return table;
|
||||
|
@ -201,8 +202,9 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
|||
|
||||
Long maxQueueSize = null;
|
||||
String keepAlive = null;
|
||||
Integer minThreads = null;
|
||||
Integer maxThreads = null;
|
||||
Integer core = null;
|
||||
Integer max = null;
|
||||
Integer size = null;
|
||||
|
||||
if (poolInfo != null) {
|
||||
if (poolInfo.getQueueSize() != null) {
|
||||
|
@ -211,11 +213,15 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
|||
if (poolInfo.getKeepAlive() != null) {
|
||||
keepAlive = poolInfo.getKeepAlive().toString();
|
||||
}
|
||||
if (poolInfo.getMin() >= 0) {
|
||||
minThreads = poolInfo.getMin();
|
||||
}
|
||||
if (poolInfo.getMax() >= 0) {
|
||||
maxThreads = poolInfo.getMax();
|
||||
|
||||
if (poolInfo.getThreadPoolType() == ThreadPool.ThreadPoolType.SCALING) {
|
||||
assert poolInfo.getMin() >= 0;
|
||||
core = poolInfo.getMin();
|
||||
assert poolInfo.getMax() > 0;
|
||||
max = poolInfo.getMax();
|
||||
} else {
|
||||
assert poolInfo.getMin() == poolInfo.getMax() && poolInfo.getMax() > 0;
|
||||
size = poolInfo.getMax();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,8 +234,9 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
|||
table.addCell(poolStats == null ? null : poolStats.getRejected());
|
||||
table.addCell(poolStats == null ? null : poolStats.getLargest());
|
||||
table.addCell(poolStats == null ? null : poolStats.getCompleted());
|
||||
table.addCell(minThreads);
|
||||
table.addCell(maxThreads);
|
||||
table.addCell(core);
|
||||
table.addCell(max);
|
||||
table.addCell(size);
|
||||
table.addCell(keepAlive);
|
||||
|
||||
table.endRow();
|
||||
|
|
Loading…
Reference in New Issue