[Monitoring] Reduce NodeStats Collection to required Data (elastic/x-pack-elasticsearch#1240)

This changes from collecting every index statistic to only what we actually want. This should help to reduce the performance impact of the lookup.

Original commit: elastic/x-pack-elasticsearch@80ae20f382
This commit is contained in:
Chris Earle 2017-06-30 19:42:44 -04:00 committed by GitHub
parent 7b3b2d5f02
commit 02c0ad2aad
1 changed files with 12 additions and 1 deletions

View File

@ -31,6 +31,16 @@ import java.util.Collections;
*/
public class NodeStatsCollector extends Collector {
private static final CommonStatsFlags FLAGS =
new CommonStatsFlags(CommonStatsFlags.Flag.Docs,
CommonStatsFlags.Flag.FieldData,
CommonStatsFlags.Flag.Store,
CommonStatsFlags.Flag.Indexing,
CommonStatsFlags.Flag.QueryCache,
CommonStatsFlags.Flag.RequestCache,
CommonStatsFlags.Flag.Search,
CommonStatsFlags.Flag.Segments);
private final Client client;
public NodeStatsCollector(Settings settings, ClusterService clusterService,
@ -43,7 +53,7 @@ public class NodeStatsCollector extends Collector {
@Override
protected Collection<MonitoringDoc> doCollect() throws Exception {
NodesStatsRequest request = new NodesStatsRequest("_local");
request.indices(CommonStatsFlags.ALL);
request.indices(FLAGS);
request.os(true);
request.jvm(true);
request.process(true);
@ -67,4 +77,5 @@ public class NodeStatsCollector extends Collector {
return Collections.singletonList(nodeStatsDoc);
}
}