Monitoring: Add more thread pool stats

This commit adds stats for generic/get/management/watcher thread pools.

Related to elastic/elasticsearch#1750

Original commit: elastic/x-pack-elasticsearch@8b001b50c6
This commit is contained in:
Tanguy Leroux 2016-03-25 15:40:06 +01:00
parent 6fab4680a2
commit a3807b078d
2 changed files with 28 additions and 4 deletions

View File

@ -56,9 +56,27 @@ public class NodeStatsResolver extends MonitoringIndexNameResolver.Timestamped<N
"node_stats.jvm.gc.collectors.old", "node_stats.jvm.gc.collectors.old",
"node_stats.jvm.gc.collectors.old.collection_count", "node_stats.jvm.gc.collectors.old.collection_count",
"node_stats.jvm.gc.collectors.old.collection_time_in_millis", "node_stats.jvm.gc.collectors.old.collection_time_in_millis",
"node_stats.thread_pool.index.rejected", "node_stats.thread_pool.bulk.threads",
"node_stats.thread_pool.search.rejected", "node_stats.thread_pool.bulk.queue",
"node_stats.thread_pool.bulk.rejected", "node_stats.thread_pool.bulk.rejected",
"node_stats.thread_pool.generic.threads",
"node_stats.thread_pool.generic.queue",
"node_stats.thread_pool.generic.rejected",
"node_stats.thread_pool.get.threads",
"node_stats.thread_pool.get.queue",
"node_stats.thread_pool.get.rejected",
"node_stats.thread_pool.index.threads",
"node_stats.thread_pool.index.queue",
"node_stats.thread_pool.index.rejected",
"node_stats.thread_pool.management.threads",
"node_stats.thread_pool.management.queue",
"node_stats.thread_pool.management.rejected",
"node_stats.thread_pool.search.threads",
"node_stats.thread_pool.search.queue",
"node_stats.thread_pool.search.rejected",
"node_stats.thread_pool.watcher.threads",
"node_stats.thread_pool.watcher.queue",
"node_stats.thread_pool.watcher.rejected",
}; };
public NodeStatsResolver(MonitoredSystem id, int version, Settings settings) { public NodeStatsResolver(MonitoredSystem id, int version, Settings settings) {

View File

@ -37,6 +37,7 @@ import org.elasticsearch.monitor.os.OsProbe;
import org.elasticsearch.monitor.process.ProcessProbe; import org.elasticsearch.monitor.process.ProcessProbe;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.threadpool.ThreadPoolStats; import org.elasticsearch.threadpool.ThreadPoolStats;
import org.elasticsearch.watcher.execution.InternalWatchExecutor;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
@ -122,9 +123,14 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
}; };
Map<Index, List<IndexShardStats>> statsByShard = new HashMap<>(); Map<Index, List<IndexShardStats>> statsByShard = new HashMap<>();
statsByShard.put(index, Collections.singletonList(new IndexShardStats(shardId, new ShardStats[]{shardStats}))); statsByShard.put(index, Collections.singletonList(new IndexShardStats(shardId, new ShardStats[]{shardStats})));
List<ThreadPoolStats.Stats> threadPoolStats = Arrays.asList(new ThreadPoolStats.Stats(ThreadPool.Names.INDEX, 0, 0, 0, 0, 0, 0), List<ThreadPoolStats.Stats> threadPoolStats = Arrays.asList(
new ThreadPoolStats.Stats(ThreadPool.Names.BULK, 0, 0, 0, 0, 0, 0), new ThreadPoolStats.Stats(ThreadPool.Names.BULK, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(ThreadPool.Names.SEARCH, 0, 0, 0, 0, 0, 0) new ThreadPoolStats.Stats(ThreadPool.Names.GENERIC, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(ThreadPool.Names.GET, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(ThreadPool.Names.INDEX, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(ThreadPool.Names.MANAGEMENT, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(ThreadPool.Names.SEARCH, 0, 0, 0, 0, 0, 0),
new ThreadPoolStats.Stats(InternalWatchExecutor.THREAD_POOL_NAME, 0, 0, 0, 0, 0, 0)
); );
return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT), 0, return new NodeStats(new DiscoveryNode("node_0", DummyTransportAddress.INSTANCE, Version.CURRENT), 0,
new NodeIndicesStats(new CommonStats(), statsByShard), OsProbe.getInstance().osStats(), new NodeIndicesStats(new CommonStats(), statsByShard), OsProbe.getInstance().osStats(),